Skip to main content

Now() Versus Today() Functions

Comments

2 comments

  • Harry Markarian

    Glen,

    This post encapsulates two things I like very much: a mystery needing solved and a trip in the Archer "way back" machine. As such, I took some time to dive into the history of the NOW() and TODAY() functions.

    It looks like from the inception of the function up until Dec 2010 they both returned DateTime.UtcNow as their result. With a code change made in Dec 2010 as the result of a customer reported defect with the way data feeds were handling the NOW() function, it was updated to instead use DateTime.Now for its result. This change stayed in place until May 2011, when a code merge reverted the NOW() function to using DateTime.UtcNow, and it has remained that way ever since.

    As a result, releases of Archer shipped between Dec 2010 and somewhere around mid-2011 (I'm not sure what release dates there were after the revert) would have had NOW() returning local time, where every other release of the product before and after are using UTC.

    0
  • Harry Markarian

    Hi Scott,

    After digging into old emails what I found was it was March of 2013 when I called tech support and told them I was using the Today() function and getting the incorrect date.  Tech support told me to use the Now() function, email from Grady Roos "I think that instead of using TODAY() you should use NOW.  The reason that TODAY() isn't working for you is that it is written in GMT at to the DB, so if I place a field onto my layout with time displaying, my timezone CDT (utc-6) shows that the work was done yesterday at 7PM.  If I use the NOW function, the work shows with the correct timezone offset if I display the time, as 1200 pm.  If I have the field set to display Date only, it displays the correct day."

    We changed all our calculations to use the Now() function and life was perfect.

    Then in Dec of 2013 I emailed tech support because the Now() function was returning the incorrect date after 8:00pm.  I received an email from Lance Walley, "....What you are seeing here is actually a logged issue (RT 7322898) that occurs due to the way Archer processes times on the back end in GMT. You should be able to add the time information to the field display as well to work around the issue for now. I am afraid the RT is not assigned to a release at this time but you can reference the RT number to get updates going forward.  I will assign this issue to the next available Engineer if you have any further questions."

    I do not have any record when it was corrected and delivered in a release.  I am also not sure when it stopped working in our system unless I do some digging.

    glen

    0

Please sign in to leave a comment.