LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

local time to us timezone

Hi to all,

 

Is it possible to display a different timezone from your local PC? Ex. My PC is set in Philippines timezone but I want to display US timezone during the query. Hope anyone can answer my question. Thanks in advance. 

0 Kudos
Message 1 of 20
(4,002 Views)

Is this related to LabVIEW?

 

Can you post a simple VI that shows what code you are working with?

0 Kudos
Message 2 of 20
(3,990 Views)

Hi,

 

Yes. This is labview related. What I'm trying to do is to display other timezone without changing my current PC timezone. I can easily display my current timezone and local date/time using the Format Date/Time String but I cannot find a function for displaying other timezone (in this case US timezone). 

0 Kudos
Message 3 of 20
(3,978 Views)

Add or subtract from the timestamp the number of hours different between the two time zones before converting it to a string.

0 Kudos
Message 4 of 20
(3,969 Views)

@RavensFan wrote:

Add or subtract from the timestamp the number of hours different between the two time zones before converting it to a string.


Of course, RavensFan knows that the TimeStamp is in seconds, so if the difference in time zones is +7 hours, you would add 7*60*60 to the local TimeStamp to get the equivalent TimeStamp in the other Time Zone.

 

Bob Schor

0 Kudos
Message 5 of 20
(3,959 Views)
And of course both RavensFan AND Bob_Schor understand that the best way to do.math on time values is to use units. By assigning a time unit to all the values, you can add and subtract values without worrying about converting everything to a common unit.

Mike... 😇

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 20
(3,926 Views)

Thank you guys, for all of your replies. I was able to figure out the initial problem using the attached code. However, I want my final output to be in military (24-hour) time, same as the input format. Any suggestions?

 

Thanks again.

0 Kudos
Message 7 of 20
(3,915 Views)

Hi rctrigger,

 

wow, a lot of code for a simple add/subtract operation:

check.png

You haven't understand that "use a DBL float with unit enabled" thing before?

 

I want my final output to be in military (24-hour) time

Then you need to use a proper display format or format string. All the formatting options are explained in the help!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 20
(3,906 Views)

Yeah units are great until they don't work, then they are terrible.  You can achive similar results if you change the display format of the double constant and show it as relative time HH: MM: SS then have the constant have a value of 4:00:00, of course with a comment or a label explaining the format.  This also allows to mix units in relative time and you can subtrac 4 hours 2 minutes with 4:02:00.

Message 9 of 20
(3,865 Views)

Yes, well time calculations are an area where units work really well. For example, you can easily expand on Gerd's example to add any sort of arbitrary time offset:

 

pi time.png

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 10 of 20
(3,858 Views)