cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Time Zone Conversion

It would be extremely helpful to have a built in function to convert a time stamp between time zones using the tz database (more info: https://data.iana.org/time-zones/tz-link.html and https://en.wikipedia.org/wiki/Tz_database).  I regularly need to convert time stamps from one time zone to another, but can't simply apply an offset, but it is time consuming to have to look up the offsets to convert the time stamp.  Additionally, there is extra work required since certain locations have daylight saving time and others don't, and daylight saving time start/end dates are location specific.

 

This function could be something like this:

 

ConvertTimeZone( ts, tzFrom, tzTo ) //ts is the time stamp will be converted from tzFrom to tzTo

//example
ConvertTimeZone( 05May2022:19:31:07, "UTC", "America/Los_Angeles" ) //result: 05May2022:12:31:07

 

 

Ideally, all datetime values would be changed to contain the time zone, and be set to default of UTC, if not specified.

 

Each time zone should use the TZ database name (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), as is used in other programming languages (e.g.: Python).

 

Here is a question about this issue: https://community.jmp.com/t5/Discussions/Time-zone-conversion/m-p/331514#M58032

 

For a very humorous description of the time zone issue, watch this video: https://www.youtube.com/watch?v=-5wpm-gesOY&t=3s. It is 10 minutes long, but well worth the *time* (pardon the pun).

7 Comments
Craige_Hales
Super User

Nice video reference, thanks.

 

JSL BLOB in an ESP32 Clock  discuses some of the timezone issues. I also briefly understood the International Dateline better after making this video with two day names at the bottom edge.

 

Working with time is really hard.

Status changed to: Acknowledged

Hi @Judah, thank you for your suggestion! We have captured your request and will take it under consideration.

SamGardner
Level VII
Status changed to: Investigating
 
SamGardner
Level VII
Status changed to: Not Planned For Now

@Judah Thanks again for the idea.  After some research, we have decided to not pursue this at this time. 

TSMETC-B
Level I

So, I am pulling some data from a Haas CNC Machine into JMP for analysis.

The Haas Time value is reported as:  123626 or, HHMMSS

When I use the JMP Data Table Column Format commands to convert Haas HHMMSS to HH:MM:SS 123626 becomes 10:20:26 AM.

We are in the MST Time Zone, so a +2:00:00 correction gets me close to the correct time.  And I can sort of understand why this error exists. . . . 

What I don't get is why I also need to make a 00:16:00 to get the MINUTES correct.

 

For my current purposes I can use a hard-coded conversion to make my small experiment work. 

My concerns are:

How I'll deal with this error in a JSL version of my analysis. 

And will it work the same as I pull more data from different machines? 

Where should I expect other time errors to arise?

(This came from JMP17.2)

Craige_Hales
Super User

@TSMETC-B  - You would have to do something to tell JMP those digits represent HHMMSS.

JMP represents times in seconds and date-times in number of seconds since 1jan1904. 123626 is 1 day, 10 hours, 20 minutes, and 26 seconds ... in seconds.

Craige_Hales_0-1746649832959.png

When you read the 123626 into a data table, you either want to immediately convert it from its external character string "123626" form to a time, or you want to keep it as a JMP character column. It gets harder if JMP loads it into a numeric column as 123626 base 10, which I believe is what you've got.

Recent versions of JMP include a format pattern that can help:

Craige_Hales_1-1746651424428.png

I recommend using a Format (for output) with : separators and making the input format match the data.

You'll probably get better answers in the discussion forum than here.

 

TSMETC-B
Level I

Hi @Craige_Hales .  That works great!  Thank you for taking time to answer my question!

 

Interestingly,  I had a column in my Data Table established with those same settings.  But I was getting spurious results.

 

It turns out that if I TYPE in the value123626 the converted Time value is indeed 12:36:26 PM.

But, if I PASTE in in the value123626 the converted Time is oddly off (of course I am now unable to recreate the error).

And, if I enter the raw time data in it's own column (Haas Time), to preserve the original data, and create a second column (Converted Haas Time) configured as described above, but with a formula ":Haas Time" importing the 123626 value from the Haas Time column, the converted Time value becomes 10:20:26 AM which is wrong by 2:16:00 . . . 

 

For now I have a good working table for manually entered data.  I'll let you know if I can automate the entry and conversion going forward.

 

Thanks again for the assistance!  It really helped!