![]() |
||||||||
| |
||||||||
4Test Tips - DATE and TIME DataDATETIME Variables can be set with string dataWithin functions, you may assign a string in ISO standard date format to a DATETIME variable. It will be implicitly cast to DATETIME. If you are trying to set a global variable (outside of a function call) then you will need to explicitly cast it to DATETIME. Thus the assignment statements would look like: DATETIME dtAnytime = [DATETIME] "2001-04-01 12:34:00" MyFunction ( STRING sInput)
Casting to TIME can change DATE portion of DATETIME variablesIf you are attempting to get the time portion of a DATETIME variable by casting the variable to TIME, the date portion of the source variable will be set to the present date. More specifically, for the statement below: tThen = [TIME] dtThenboth the tThen and the dtThen variables will be modified. The surprise is that dtThen gets today's date. Normal programming languages do not modify variables to the right of an assignment operator. This behavior has been seen on 32-bit Windows QAP 4.6.2 and on Solaris 2.5 with QAP 4.0. On 1999-03-11, Segue
technical support said, "It may not be intuitive, but it's working
as designed." The documentation of the TIME data type says,
"If you cast from a type DATETIME to a TIME, you lose the date information."
Many people may have thought it was only the TIME variable that lost the
date information. But the input DATETIME variable also loses it
because it is replaced with today's date! (get
test here) DATETIME dtTemp
|
||||||||
|
Send
questions or comments about this web site to: webmaster@TestMap.com |
||||||||