Copy link to clipboard
Copied
I am using GetHttpTimeString() function to get the current date and time in UTC/GMT. But when I format it using DateTimeFormat, its returning different results:
In CF2016, when I do this:
<cfdump var="#GetHttpTimeString()#">
<cfdump var="#DateTimeFormat(GetHttpTimeString(), "yyyy-mm-dd HH:nn:ss")#">
it will return:
Tue, 18 Sep 2018 17:44:27 GMT --> UTC
2018-09-18 17:44:27 --> still in UTC
In CF2018, when I do this:
<cfdump var="#GetHttpTimeString()#">
<cfdump var="#DateTimeFormat(GetHttpTimeString(), "yyyy-mm-dd HH:nn:ss")#">
it will return:
Tue, 18 Sep 2018 17:44:27 GMT --> UTC
2018-09-18 12:44:27 --> current date/time in my timezone
Unless I pass a third argument for the timezone, it will use the server's timezone by default.
Is this an intentional change, if it is, I can't find anything in the 2018 Release Notes.
Thank you!
Ollie de Guzman
Copy link to clipboard
Copied
The problem might be that you're not passing an argument to the function getHttpTimeString(). Do something like getHttpTimeString(now()).
Copy link to clipboard
Copied
Hi,
I tried adding Now() as an argument to the getHttpTimeString() function, I am still getting the same results from my OP.
Thanks!
Copy link to clipboard
Copied
roldeguz wrote
Hi,
I tried adding Now() as an argument to the getHttpTimeString() function, I am still getting the same results from my OP.
Then perhaps it's because getHttpTimeString(now()) returns a string, whereas dateTimeFormat() requires a datetime object. So your next try is
dateTimeFormat(parseDatetime(getHttpTimeString(now())), "yyyy-mm-dd HH:nn:ss")
Copy link to clipboard
Copied
Hi,
I did what you suggested by adding parseDateTime.
In CF2016, it returned the date/time in UTC/GMT while in 2018, it returned the date/time in the server's timezone.
Thanks!
Copy link to clipboard
Copied
Then you should report a bug.
Copy link to clipboard
Copied
I don't see this behaviour when I look at your sample code on trycf: https://trycf.com/scratch-pad/gist/8c4cc8f8aad9d648091b61f37951e25b
Copy link to clipboard
Copied
Hi,
Have you tried it on both CF 2016 and CF2018?
Copy link to clipboard
Copied
Can you send me an email at cf.install@adobe.com so that we can get together and look into this issue?