Now() Versus Today() Functions
Today() Versus Now() functionality.
Good afternoon folks;
I have been working with RSA Archer technical folks on what I believe is a production problem but am being told it is expected behavior.
The background is in the current system if you use the Now() or Today() function in a calculation it returns the date based on Greenwich Meantime (GMT). What this means is if you execute a calculation after 8:00 PM the date returned would be the next day if you have the field configured as just a date field. However, if your date field is configured as date and time it would return the current day if you use the Now() function and the next day if you used the Today() function.
I am 99% sure at one time the Now() function always returned the current date regardless of how you configured the date field and the Today() function always considered GMT, this is why there were 2 different functions. The only reason I am this sure it worked this way at one time is when I new to configuring I happen to use the Today() function not knowing any difference and any record after 8:00 PM had the incorrect date. I spoke with Archer and they said use the Now() function so we updated our calculations and established a development standard to always use the Now() function.
I am being told by Archer that it always worked as it does today in the system. If I want the date without considering GMT use the Now() function and configure your date field to be date and time or update your calc to subtract 4 hours when you need to.
My questions is does anyone have any memory on how Now() and Today() worked in the past?
Thanks
-
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 -
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.
Comments
2 comments