CTOD(1)
PURPOSE
This function will return the given field as an D type (date) field.
PARTS
| 1 f/c/e | Required - The field to be converted to D type. |
RETURN TYPE - D
COMMENTS
B, F, P, T, and L type fields cannot be converted to D; however, all others can (including A type fields). The size of the resulting date depends on the receiving field, regardless of the value that is converted.
Example
In English (United States) this will work and produce the date as 01/01/ + System date year.
msg 'test CTOD '+ CTOD('01/01/'+ year(date()))
If your computer is set for another country where the date format might be Dutch (Netherlands) you must use the correct separator for that region or country. If the wrong separator is used the retuned value will be 00-00-00.
msg 'test CTOD '+ CTOD('01-01-'+ year(date()))
In Dutch (Netherlands) this will work and produce the date as 01-01- + System date year.
NOTE: This function must be formatted with the correct separator for the target country or region the computer will be working with. or there could be errors in the calculation.
NOTE: Here is one line of code that can extract the date separator for you.
define ds type A size 1 value mid(str(date()),3,1)
//ds will equal your date separator
Page url: http://www.cassoftware.com/tas/manual/convertalphatodate().htm