03-11-2009 06:11 AM
I tried to deal with the problem converting between Timestamp and Cluster of time. However, the conversion gives strange results. Take this as an example:
The problem can be easily solved using conversion to string:
03-11-2009 09:42 AM
Hi Y,
I am not sure I understand your question. I think the reason your date time rec cluster did not give you what you expected in your timestamp is because you did not set the DST field to 1. Does this answer your question? If not, walk me through the problem you are having.
03-11-2009 09:50 AM
03-12-2009 04:45 AM
jmcbee, smercurio…, Thank you for the replies. Probably my post was not sufficiently clear because I try to discuss two interrelated questions: i) "How LabVIEW deals with conversion of time scale?" (a broad subject) and ii) "What is a good way to deal with dates only?" (practical problem).
smercurio…, this is not a floating point problem. I tried different couples of dates also indicating DBL values. The problem is caused by the daylight saving jumps.
jmcbee, yes, if DST is set to 1 this conversion is ok but conversion for 2009-03-28 (for example) needs a manual set of DST to 0. So, I have to deal with the same problem – with the need to know when a government (king, dictator, referendum) of a country decides to shift sun in the skies
The particular problem is quite simple. I want to operate (plus, minus, etc.) with a scale of days and be able to see corresponding dates in GUI. As a fact, I already solved the problem (the idea is in the third diagram of the first post). I operate with objects where the internal representation is numerical while interactions with GUI are performed using the string-conversion procedures. The jumps are only plus-minus1 hour; if the reference is 12:00 the "string-rounding" always results in the same day.
This approach can be a "quick-fix" but, to my feeling, a more reasonable way should exist.
03-13-2009 04:58 AM
03-26-2009 09:07 AM
Hi Y
This may be a sidetrack, but I've always found that when working with dates it's easier to convert them to Julian Day. Then you can easily subtract, add or compare dates in a rubust way. Maybe that is something to consider? Attaching a VI that converts to Julian Date (Julian Day plus time in fraction of a full day).
Best Regards
David