• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

DateTimeFormat returns different results in CF2016 and 2018

New Here ,
Sep 18, 2018 Sep 18, 2018

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

Views

475

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2018 Sep 18, 2018

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()).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 18, 2018 Sep 18, 2018

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2018 Sep 18, 2018

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")

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 18, 2018 Sep 18, 2018

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 20, 2018 Sep 20, 2018

Copy link to clipboard

Copied

Then you should report a bug.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Sep 22, 2018 Sep 22, 2018

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 24, 2018 Sep 24, 2018

Copy link to clipboard

Copied

Hi,

Have you tried it on both CF 2016 and CF2018?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Sep 24, 2018 Sep 24, 2018

Copy link to clipboard

Copied

LATEST

Can you send me an email at cf.install@adobe.com so that we can get together and look into this issue?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation