Page 1 of 1

Anybody get new Date().toISOString()?

PostPosted: Thu Apr 22, 2021 4:57 am
by joe26
Good Morning!

Trying to execute, new Date().toISOString(), I just get a Date string along with Time Zone, etc.

I'm not getting something like, '2011-10-05T14:48:00.000Z'

Am I missing something?

thanks,
--Joe.

Re: Anybody get new Date().toISOString()?

PostPosted: Thu Apr 22, 2021 9:14 am
by jcompagner
for me if i do:

application.output(new Date().toISOString());

it prints

2021-04-22T07:12:46.304Z

Re: Anybody get new Date().toISOString()?

PostPosted: Fri Apr 23, 2021 5:46 am
by joe26
I've got the following, after setting to the Sydney, Australia locale.

Code: Select all
=>plugins.UserManager.Server().locale;
"English (Australia)"
=>new Date()
Fri Apr 23 08:17:57 AEST 2021


Code: Select all
=>importDate = new Date()
Fri Apr 23 08:19:04 AEST 2021
=>importDateRaw = importDate
Fri Apr 23 08:19:04 AEST 2021
#assignment to another variable is fine. Change it to a string, and it comes back to my local system even when it is set to Sydney as well.
=>importDateRaw.toString()
"Thu Apr 22 2021 17:19:04 GMT-0500 (GMT-05:00)"

Re: Anybody get new Date().toISOString()?

PostPosted: Fri Apr 23, 2021 9:03 am
by jcompagner
but how is that related to what i do?
you depend/use the toString() not the toISOString what i do.

Re: Anybody get new Date().toISOString()?

PostPosted: Fri Apr 23, 2021 8:37 pm
by joe26
Johan,

My apologies. It really doesn't.

The issue looks to be more the format change between the toUTCString() or toISOString() with the toString() format reverting the output format.

Haven't played with the to define what's really going on. The initial gives me the ISO format, but toString() seems to put it back in the standard output format.

I'll get back with more info, but that means I need to put my system back in another timezone, etc.

--Joe.