top of page
Search

1970? Unix Time in a Knack Database

Writer: Dave ParrishDave Parrish

Updated: Jun 2, 2024



Here's an other post that you might like: Dates & Time in Knack


Interested in my Knack database app services? ... Book a call with me here: https://calendly.com/daveparrish/callwithdave


Unraveling the Mystery of Whacky Numbers in Data Equations: A Dive into Unix Time

Hey there, it's Dave Parrish with knackbuilders.com, back with another video for you. Today's topic might ring a bell for many of you – "January 1, 1970." Confusing, right? Well, I recently had a run-in with this perplexing issue, and I thought I'd share my insights with you all.


Unix Time Unveiled

What your are seeing is Unix Time and how Knack and most systems handle it. Ever had to deal with date equations resulting in bizarre numbers? You're not alone. Picture this: you have start and end dates, but one of them is blank, and suddenly, you're staring at a completely nonsensical figure. It happened to me recently, and trust me, it's not fun to explain to clients. But fear not, I've got some tricks up my sleeve to tackle this head-on.


Into the Technical We Go

Let's dive into the heart of the matter. I've got this handy app for demonstration purposes. We've got fields for "Order date" and "Ship date." Simple enough, right? But watch what happens when both fields are blank – you get a big fat zero. Now, let's throw in a random date for the order but leave the ship date blank. What do we get? Negative 19,723. Mind-boggling, isn't it?


Deciphering Unix Time

Here's where things get interesting. Ever heard of Unix time? It's essentially the starting point of computer time, dating back to January 1st, 1970. Don't worry; you don't need to be a tech whiz to understand this. The crucial takeaway is that blank dates default to this Unix epoch, hence the wonky numbers.


Cracking the Code

Now, how do we fix this? One approach is to employ display rules on your detail page. If the ship date is less than zero (meaning it's in the Unix epoch realm), hide it until a valid date is inputted. Another method involves creating a separate field and using conditional rules to determine its visibility based on the ship date's validity.


Putting It into Practice

By implementing these strategies, you can ensure that your data equations behave sensibly and that your clients don't end up scratching their heads over inexplicable numbers. So, next time you encounter these oddities, remember – it's all about Unix time.


Signing Off

Well, that's a wrap for today, folks. Thanks for tuning in. Until next time, take care, and building your Knack database apps!





 
 
 

Comments


bottom of page