취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

string to datetime interesting problem

해결 완료!
솔루션으로 이동

Hello,

 

I am solving some issue with Labview and I find quite interesting bug.

 

It is just time conversation from string to datetime format.

In the picture below I made 24 times this conversation to show, what the result is for each hour of the day.

It looks like labview have some problem with conversation times in format 2:XX:XX (I mean, when number 2 is the first).

 

Has anyone any idea, how to solve that bug?

0 포인트
1/11 메시지
4,850 조회수

Hi vasicek,

 

well, it appears to correlate with changing from "standard" time to daylight savings time (last Sunday in March & October for great parts of Europe)…

 

Remember: the timestamp indicator will always (or: by default) adapt to your local OS timezone settings!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
2/11 메시지
4,838 조회수

Thanks for your reply!

 

I think that you are right, it is a time change, but is there any possibility to avoid that thing? I mean, I wanna use "the missing hour" in my code, is it possible?

 

Thanks!

0 포인트
3/11 메시지
4,805 조회수

The problem is the hour isn't really "missing".  It never exists.

 

So what do you mean by using the "missing" hour?  You might need to modify your code to account for that.  Or you might want to modify your code so it outputs the values in terms of Greenwich Mean Time or Universal Time.

0 포인트
4/11 메시지
4,794 조회수

That hour exists! in many countries for example...

 

My goal is get the same time in timestamp as I setted in string...even if the timechange is occur.

 

Thank you!

0 포인트
5/11 메시지
4,779 조회수

@vasicekv wrote:

My goal is get the same time in timestamp as I setted in string...even if the timechange is occur.


Then you need to standardize on UTC time.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
6/11 메시지
4,772 조회수

@vasicekv wrote:

That hour exists! in many countries for example...

 

My goal is get the same time in timestamp as I setted in string...even if the timechange is occur.

 

Thank you!


No.  It doesn't.  One day a year has 23 hours.  One day a year has 25 hours.   2:00-3:00 am hour  doesn't exist when clocks jump forward at 2am in the spring.  The 1:00-2:00 am hour exists twice when clocks jump back in the fall.

 

If you are in a country that doesn't have daylight savings time, then that would be reflected in your PC settings and the behavior of the missing hour or extra hour would not show up.

0 포인트
7/11 메시지
4,760 조회수

Please, we should be focused on the problem.

The easiest explanation of my problem again: I have time string "29.3.2015 2:10:00.000" and I wanna convert it to timestamp with the same time, but the result is now one hour lower because of timechange.

Is there some easy way, how to solve that? Should I change some settings somewhere?

 

Thanks for your reply!

0 포인트
8/11 메시지
4,752 조회수

Hi vasicek,

 

you could set your computer to use UTC.

Or you can play with "Date/Time to Seconds" function and its LVDateTimeRec datatype…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
9/11 메시지
4,732 조회수
솔루션
주제 작성자 vasicekv이(가) 승인함

The solution is:

1.convert variant to string

2.string convert to variant with format string %^<%d.%m.%Y %H:%M:%S>T, where ^ is important

3.use Format Date/Time String.vi with UTC set to True

0 포인트
10/11 메시지
4,632 조회수