Navigation:  Reference > Functions >

ConvertToDate()

Print this Topic Previous pageReturn to chapter overviewNext page

 

CTOD(1)

 

PURPOSE

This function will return the given field as an D type (date) field.

 

PARTS

 

1 f/c/eRequired - 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

 

SEE ALSO

DATE()   Convert to Date CTOD() Convert to time CTOT()   TIME GET SET  Convert time to record TTOR()  Covert time to number TTOF() Convert time to string TTOC()

TIME() YEAR() Date Command  Date to Record DTOR()  Convert date to Character DTOC() Days in month DAY_IN_MONTH

Increment the Month INC_MONTH DayMonthyear DMY()  Month Day Year MDY()

Charicter of month CMNTH()  Charicter to day of week CDOW()

 

 

 

 

 


Page url: http://www.cassoftware.com/tas/manual/convertalphatodate().htm