Anybody get new Date().toISOString()?

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

Anybody get new Date().toISOString()?

Postby joe26 » Thu Apr 22, 2021 4:57 am

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.
joe26
 
Posts: 172
Joined: Wed Jun 19, 2013 10:30 pm

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

Postby jcompagner » Thu Apr 22, 2021 9:14 am

for me if i do:

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

it prints

2021-04-22T07:12:46.304Z
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

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

Postby joe26 » Fri Apr 23, 2021 5:46 am

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)"
joe26
 
Posts: 172
Joined: Wed Jun 19, 2013 10:30 pm

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

Postby jcompagner » Fri Apr 23, 2021 9:03 am

but how is that related to what i do?
you depend/use the toString() not the toISOString what i do.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

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

Postby joe26 » Fri Apr 23, 2021 8:37 pm

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.
joe26
 
Posts: 172
Joined: Wed Jun 19, 2013 10:30 pm


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 15 guests

cron