Solved Removing time stamp from "Date/Time" Fields (1 Viewer)

Bean Machine

Member
Local time
Today, 15:44
Joined
Feb 6, 2020
Messages
102
Hi All! I'm having trouble removing the time on a date/time field in a table. I want to use "mm/dd/yyyy" format but every time I try to make use of the format it adds a time to the field as well. I have tried looking around for solutions (perhaps I'm not looking hard enough) but its getting really frustrating as this seems like something that should be simple. I appreciate any help in the matter!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:44
Joined
Oct 29, 2018
Messages
21,474
Hi. How exactly are you populating the field? If you have Now() set as the Default Value, change it to Date() instead.
 

Bean Machine

Member
Local time
Today, 15:44
Joined
Feb 6, 2020
Messages
102
Oh my gosh I can't believe I forgot about that... Will do, and thanks for the help! Had similar troubles a long time ago, my mistake, sometimes its the simple things I forget to remember.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:44
Joined
Oct 29, 2018
Messages
21,474
Oh my gosh I can't believe I forgot about that... Will do, and thanks for the help! Had similar troubles a long time ago, my mistake, sometimes its the simple things I forget to remember.
Happens to the best of us. Good luck with your project.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:44
Joined
Feb 19, 2002
Messages
43,280
Just to be clear, the date datatype ALWAYS includes time. The datatype is actually a double precision number with the integer part being the number of days since 12/30/1899 and the decimal part being the fraction of the day since midnight. If the decimal is 0, then time will not show using the default format.

Also, formatting a date is appropriate for human consumption but will generally cause trouble in other cases unless you know exactly what you are doing. Just be aware that the Format() function converts a date to a string and that will make the date act like a string rather than a numeric value. Therefore 01/01/2021 will be less than 12/31/2010 for a string compare (because "01" is less than "12" and the January date will also sort ahead of the December date in an order by clause whereas if you compare/sort using the actual date field, the results will be as you would expect.
 

Isaac

Lifelong Learner
Local time
Today, 12:44
Joined
Mar 14, 2017
Messages
8,777
FWIW I like to err on the side of caution and capture time values in almost all of my systems. It's easy to strip off the time portion of stored data later on, but it's awfully hard to go back in time and capture it! More than a few times I've thought I would never need it, but ended up (after a while) some reason would come up why I did, so from then on I kind of just fell into the habit of most always capturing it, even when seemingly unnecessary.
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:44
Joined
Feb 19, 2002
Messages
43,280
Since you know how to handle dates with times, that's fine. I store time frequently also.
 

Isaac

Lifelong Learner
Local time
Today, 12:44
Joined
Mar 14, 2017
Messages
8,777
Yeah I was just chuckling thinking about how, I can remember that the most common thing that seems to come up for me with respect to the value of the time capture doesn't even have to do with any core purpose of the app! It's just that it helps ME, as a dev, during the first few weeks/months of its usage (when I am typically still solving problems, troubleshooting things, or having to 'explain' why 'this' or 'that' happened like so)....... It helps me a lot to see "Ahh...Such and such user marked that record in that way at 1:15 PM, which explains why such-and-such other thing happened at 1:16 PM (or whatever the case may be). Gives a lot of behind the scenes insight into app usage and, since i'm an imperfect developer who makes mistakes, helps me catch them and figure things out, honestly
 

Users who are viewing this thread

Top Bottom