top of page

Dates & Time in a Knack Database

Updated: Sep 24, 2022

Questions about your Knack app? Let's Chat.​. Here I discuss several topics on managing dates and time in your Knack database app. General settings, field creation, date equations, special functions, and something called, "unix time".

Get a free Knack trial account here:

If you are a fan of building great apps with Knack, please click the Subscribe button to join my channel, and ring the bell to receive notices on all my new instructional videos. Thanks!

You can check out my Knack database services here: Knack!

Full Transcript

hello it's dave parrish here

with neck builders uh doing another


video series today's topic

is dates and time

in knack i'm going to go over some some

basics this won't be too long and some


uh it's sort of a can be a big topic i'm

going to do some broad jokes here but

there's a few interesting things you can

do to manage dates and time within your

nat gap uh i'll be back in just a moment

to go through that thank you



here i go dates and time

and knack now first something really


um if you go up to your


the settings of your app

you're gonna have some options here to

set the correct time zone and daylight

savings also that well any action that

happens it's time stamped will then

be in that time zone

but let me get into some other stuff

i just took a

any app here this is one of their


template apps but i'm not gonna add some

date fields here i already added two day

one day two

these are pretty simple i mean it's

going to give you your format

and if you want it to be

captured when a record's created

time stamp it then or not or you can set

it to a specific date and if you want to

have time or not those are

straightforward i'm sure everyone knows

that now let's do something else here


i'm gonna look at these records

i'm gonna

get rid of this one real quick

do something with these let's make an


let me get this out of here


submit that


let's do an equation that deals with



you're going to go to equation

and let's just make this uh equation

uh date

2 minus



we're dealing we're looking at dates so

we want to say it's in the date equation

and then it will can ask you what do you

want it to result in the difference

between the two by hours by days by

weeks let's do days

it doesn't do months months are a little


because they can be different

and we want this to result it can result

in a date but usually you're going to

want a number so this could be a use

case could be hey i want to know

how i invoice how late it is

or i want a

five days before an invoice is due i

want to create a task

that sends out a reminder something like

that well that's where you can use it

but let's just make this quick you're

gonna go to fields

let's do date one

or day two minus



okay there it is

and you have other options here but

we're going to sleep with default

and let's go here

let's put some values in here

let's make this it doesn't really matter

what they are i want to make this

today the fifth

and i want to make this


some the day before the fourth

okay pretty simple


the fifth is one day later than the

fourth so it results in number one

the number we want now that's all easy

and you guys can deal with that but let

me talk about something else

when i first saw what i'm going to show

you i'm like what the hell is that

let's do this let's

make this blank

so we don't have a value there

and it gives us this number nineteen


one hundred and seventy eight i'm like

what is that and that can show up a lot

there's lots of times you're not gonna


like a you've completed date you know

completed date when the record's created

isn't there yet because you haven't

completed it

and you're going to get this number here

because sometimes it could be a negative

dependent on your orientation or your


here's what this

is and i i don't know that you can

actually use it but it's something

called unix time


and what it specifically is

is january 1st


some computer person or group came up

with this thing i don't know what it

does or why it's 1970 maybe that's when


sort of

were taking over i don't know but that's

what it is and what this is


178 are the number of days since january



and i'm just going to check that let's

make this thing


oh one


submit it

now it's a zero because it's it defaults

this to be

uh when it's blank to you next time uh

1970 january 1st and so now i'm

subtracting that date from itself and

that results in a zero


that's just useful but let's let's do

something else here let me put some go

back to our other dates

um oh one


i know oh seven

oh five


so that's today

and i'm gonna make

this um

now let me show you something else and

now it's one day apart

let me this can be useful too um

there's a lot of times that you might

want to know the day a date represents

is it friday tuesday


and you can do something here too

watch this another equation

and i'm gonna say i'm gonna call this

day of



which is today


here's what i'm gonna do right here i'm

gonna go get functions i can just start

typing in this is going to be useful for

a lot of stuff


there's all these pre-made functions

get day of month

get day of week get last a month get

month get what you get it


if you have a date and you want to

extract something from this let's do it

let's call it

get day a week

and i'm gonna do i'm gonna go

for the day two

so i just made a formula

going to tell me what day a week is

now i'm going to go over here

now if you know anything about knack and

when you create a formula like that or

some other function

it takes a little bit for it to catch up

with itself after you first made it


there's tricks you can do i'm gonna i'm

gonna just

do an update

on this record i'm gonna set

his i'm just changing this


well hold on here


i'm going to update bedrooms i'm forcing

it to do something with the record when

it when you force it to do something

that engages that this should result in


doing it okay so now it is

um it gave us the value three it gives

you the number one two three four

through seven


and just so you know when they're

handling dates

in here

sunday is one so today's tuesday sunday

is one monday two

tuesday three so dates start on sunday i

think you can change that

if you're using a calendar view but this

is how it's going to handle that so we

now know

what day of the week it is 3 represents

tuesday and if you had to display that


you might want to make a conditional

field that has the days of the week

monday tuesday

et cetera listed

and then put conditions on it if date is

three make tuesday

if you know do that that can be useful



that's pretty much what i have those are

some interesting things about dates

within that

and again you can do all kinds of

complicated stuff i may have another

video on some advanced things with dates

but this gives you a general overview of

what's up appreciate it folks thanks

12 views0 comments


bottom of page