Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
pauldeen
Level IV

Use of in format() in different countries

I have a script that runs in different countries to figure out the local time offset from GMT (to determine location). For that goal I get GMT time by polling a web server, it return time in a format like: "28 Aug 2020 08:39:04" then I use In format("28 Aug 2020 08:39:04") to return 28Aug2020:08:39:04 as a datetime stamp. Now I can subtract local time - GMT time to get the time difference. This works fine in Europe and the USA but when my Korean colleague runs In format("28 Aug 2020 08:39:04") he gets . as response. Probably JMP not recognizing the month. Is there a robust way to convert this char date to a date format that works around the world?

 

I see the option of using <<use locale(b=1) as an option but cannot find how that works in the scripting index of help file.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Craige_Hales
Staff (Retired)

Re: Use of in format() in different countries

and maybe the best answer is to use @bryan_boone answer How to get the timezone from user's computer/laptop  using http request.

edit: it may still need the preference!

Craige

View solution in original post

6 REPLIES 6
Highlighted
Craige_Hales
Staff (Retired)

Re: Use of in format() in different countries

I can't test it, but I think you want this:

Informat(  "28 Aug 2020 08:39:04", "ddMonyyyy h:m:s", <<UseLocale(0)  );

which should mean "don't use the user's locale". The scripting index example shows the unary send operator, <<, so it is probably required too. 

@XanGregg 

Craige
Highlighted
pauldeen
Level IV

Re: Use of in format() in different countries

Unfortunately that doesn't work for my Korean colleague. He gets .
Highlighted
Craige_Hales
Staff (Retired)

Re: Use of in format() in different countries

this is the only way I've found to make it work.

preferences(Use JMP Locale Settings( 1 ));
Informat(  "28 Aug 2020 08:39:04", "ddMonyyyy h:m:s"  );

You can set an english language version of Windows to Korean like this:

region settingsregion settings

I hope I can set it back...

@audrey_shull  - I think the <<UseLocale(0) is probably supposed to work so the global preference isn't needed.

Craige
Highlighted
Craige_Hales
Staff (Retired)

Re: Use of in format() in different countries

actually, here's how I found the dialog...

via control panelvia control panel

Craige
Highlighted
Craige_Hales
Staff (Retired)

Re: Use of in format() in different countries

and maybe the best answer is to use @bryan_boone answer How to get the timezone from user's computer/laptop  using http request.

edit: it may still need the preference!

Craige

View solution in original post

Highlighted
pauldeen
Level IV

Re: Use of in format() in different countries

Ok, this works, thanks!

Article Labels