LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CWNumEdit

It seems difficult to determine the date with CWNumEdit form the value.For example 37633.625 means 12/01/2003. The first date 0 is 30 december 1899, but how is it possible to knows that 37633 is the first december 2003 ?.
0 Kudos
Message 1 of 6
(3,558 Views)
This is documented in the help for the control. Here is the excerpt from the help:

Note: To specify a date/time value, you must convert your date or time value to a double. A date is implemented as a floating-point value with the integer part of the number measuring days from midnight, 30 December 1899, and the fractional part representing the time of day. The absolute value of the fractional part of the number represents the time as a fraction of a day. Thus, 1 second equals 1 / 24 hours / 60 minutes, which is 1/86400 or approximately 1.157407e-5. So, midnight, 31 December 1899, is represented by 1.0. Similarly, 6 AM, 1 January 1900, is represented by 2.25, and midnight, 29 December 1899, is -1.0. However, 6 AM, 29 December 1899, is -1.25.

Best Regards,


Chris Matthews
National Instruments
0 Kudos
Message 2 of 6
(3,558 Views)
thank you but I already know that.Is there a simple way to calculate that ? It's difficult to calculate the number of days because of "bissextile" years.Is there a windows or CVI function to do that ?.

Thank you
0 Kudos
Message 3 of 6
(3,558 Views)
No, there isn't a function for that. You would have figure in the adjustment for leap years yourself.

Chris
0 Kudos
Message 4 of 6
(3,558 Views)
I'm trying to use a CWNumEdit with date as format string.I want to write the value as text using SetText() function but got an error.ERRORINFO says that the property is read only !
I don't understand because it's Set not Get function.
Is it impossible to SetText(..."12/03/2003 0:0:0") and read the value by GetValue function ?
0 Kudos
Message 5 of 6
(3,558 Views)
You can't run SetText on the CWNumEdit. Text is an inherited property from a base ActiveX control that isn't implemented for the CWNumEdit control. You have to use GetValue and SetValue with numeric values.

Chris
0 Kudos
Message 6 of 6
(3,558 Views)