LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timestamp problem with DST

I'm trying to create an array of timestamps from a string. Depending on the input format of the string, I get a DST correction (which I do not want).

 

If I convert the Easter date with the format string %<%d/%m/%Y>T from a string of %02d/%02d/%4d I get a timestamp based at 12:00am on the required date. - thie is good.

 

If I use the bit of code attached to generate all dates in the year specified, I get a DST correction. This is annoying.

 

 Dates_of_the_Year.PNG

 

Problem part 2.

 

Why does search a 1D array function never work on a timestamp array, but the Equals function does (At this point I hae the timestamps in a 2D array and it would be more effiecient to search the arrays than search through each element.

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 1 of 3
(2,987 Views)

Are you really doing this VERY performance consuming calculation just to determine if a given year is a leap year?? As to your problem, timestamp conversations do normally operate in local time for any human readable format. This includes adjustment for the daylight saving time according to your system settings.

 

You can cause the conversion to assume that the human readable form is UTC by using the format container  %^<>T for absolute timestamp conversion but this will cause the timestamps to look wrong when displayed in a normal timestamp control, which will use the local timezone settings to convert the timestamp number back into a human readable format.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 3
(2,975 Views)

No Rolf, I'm not quite as mad as it looks,

- I know I could check if the year is a leap yearby just getting the timestamp of 31/12/yy and checking to see what day number of the year it is (%j) and this may not even be the fastest way to do that!!

 

I'm doing an intellectual exercise to calculate all the English Public Holidays in a given year with the knowledge that:


New Years Day - Jan 1st or next weekday thereafter
Good Friday - Friday before Easter
Easter Monday - Monday After Easter
May Bank Holiday - 1st Monday in May
Spring Bank Holiday - Last Monday in May * except 2012
Summer Bank Holiday - Last Monday in August
Christmas Day - Dec 25th or next weekday thereafter
Boxing Day - Day after Christmas Day holiday or next weekday thereafter
 

 

 

(2012 seems to be an exception as they have moved the late May Bank holiday to June and added another one for the Queen's Diamond Jubilee).

 

I found the Easter algorithm, so now I'm just tring to match easter to a day from my array of timestamps and do a similar thing with other days that the holidays are based around.

 

Not much practical use, but a fun intellectual exercise and it should allow me to calculate which day which recycling bin is collected eventually Smiley Very Happy

 

- Is this extreme??? Smiley Tongue

 

-----

I'm not worried about human readable, I'm worried about LabVIEW comparable timestamps

----

 

James 

 

 

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 3 of 3
(2,971 Views)