top of page

1970? Unix Time in a Knack Database

Lets look at what Unix Time is in your Knack database app. You have probably run across it before without knowing what is was. Ever have a date equation result in some sort of crazy number or a date value of 1/1/1970, and you said, "What?!". That's Unix Time. Here I show you what it is, and how to deal with it. Please check it out.

Interested in my Knack database app services? ... Book a call with me here:

Full Transcript

0:01 Hey folks, Dave Parrish here. I got another video for you. This one won't be too long. I'd appreciate it if you could like the YouTube channel or the video and subscribe to the channel. 0:12 That always helps. But here's today's topic. You next time. You know what that is? If you don't you've probably run into it You ever have dates like a start end date or something and then you have an equation thats resulting lets say in a number of days between and one of those numbers is blank or it 0:32 could be a variety of reasons ill get into that and you get this completely whacked out number and youre like what is this it happens that happened to me the other day the client said whats going on with this number and i had to explain whats going on heres a couple ways to deal with it with it 0:48 too but ill im gonna just jump into this and ill be right back.

0:00 Okay, I'm going to jump right into the topic here. I have an app. This is just a test app. And I put a field in here, or a couple. 0:09 Order date, so you have an order, the date it's ordered. And a ship date. Okay, seems reasonable for all kinds of use cases. 0:16 And then you want to look as a manager or whoever The days between it was ordered and when it shipped So we have this equation that accomplishes that Use case all the time Now look at this I'm going to go over To where those, again I'm going to make myself smaller Uhhh Here we have those fields They're 0:42 both blank It's going to give us a zero Let's put in, and this by the way Almost always youre going to have an order date first and youre not going to have a shipping date because it hasnt shipped But lets put a date in here Lets just put whatever January 1st Submit it Blank ship date and we get this 1:06 weird number Negative 19,723 Like what is that? And if you have a detail Of this order A detail page And youre listing out These fields on it And this strange number comes up People are going to say what is that? 1:24 Whats going on? Well, here's where Unix time comes in Here's a wikipedia page on it But here's the important thing Some people in the know They know Or whoever they were back then Decided that the beginning of computer time Was January 1st 1970 Now if you go through this It gets really complicated Leap 1:51 seconds This deals with Leap seconds all kinds of time aspects to it It's really involved I don't know what any of this is honestly All I know is the important thing for us Is it's January 1st 1970 And specifically With this 19 Negative 19 thousand Thousand is Its the days in between January 1st 1970 2:15 And this date Uhm to show you that Im gonna We got 19 723 Lets put in 0 1 0 1 1970 Now thats true thats gonna remain the same Lets see Submit Its the same So thats its defaulting a blank date to that Which causes issues when you get these crazy numbers. 2:42 Now if we put in an actual date thats realistic let's say it's a week after so let's do this oh one let's do let's just do oh 08 and we are going to do 2000 2024 and we are going to submit it it gives us the actual reasonable date so that is what is going on here if you have a blank date the system is 3:16 thinking it is january 1st 1970 and it is whacking out what you are going to do now there is a number of ways you can deal with this one way on your detail page you can put a display rule on that view it says hey if the ship two ship days is less than zero make it blank or hide it yeah it can't be make 3:44 it blank you gotta hide it and so until we get an actual ship date the ship date is not even going to show up or there is another way to do that too lets make another field here real quick lets just do another number field here is how I usually deal with it come on number I'm going to just call it to 4:08 ship lets save it this is another power of conditional rules go back back here do a conditional rule and were going to say hey add a criteria if this one And it's the actual calculations resulting in that negative number. 4:32 Is lower than let's just put zero we're gonna make this new field blank because that's what it really is it isn't there yet let's make it blank and then let's make a second one if its higher lets do it this way if its higher i suppose it could be technically zero if its shipped on the day of the order 4:59 it could be it so lets just do this is it higher than negative one in that case we are going to make it a field value and we will make it back to what that equation was because if it has a ship date in it that equation is going to be right and we are going to save this lets see if it does slow today 5:23 lets go back to the records and over here and this did it right uhm so we do have a ship date its given us a real number and if we made this blank just to last test it out here submit we get this is blank its given us the crazy number thats related to January 1st 1970 and it results in 2 ship being blank 5:55 so when youre looking that in your live app on the detail page its gonna be there and its gonna be blank and thats what makes sense uhm thats what I got with this to give you a little insight when you run across these crazy numbers doing with data equations it has to do with Unix time. 6:11 Take care folks, thanks.

1 view0 comments

Recent Posts

See All
bottom of page