Consultor Eletrônico



Kbase P25410: How to convert a date integer to a date format
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/19/2003
Status: Unverified

GOAL:

How to convert a date integer to a date format

FIX:

The 4GL function DATE allows to convert string and integer to a date format. It converts also an integer into a date:

DATE ( integer-expression )

However in this case the integer-expression is an expression that evaluates to an integer value that represents the number of days since the origin of the 4GL date data type.

Probably you'd like to convert an integer that contains the date in itself. Like for example 100876.
In this case is more convenient to use the double conversion:

Integer ---> String ----> dateFormat

As for example:

myInt = 100876.
myDate = DATE( STRING (myInt)).


As the string value must have the format specified by the Date Format (-d) startup parameter (the default is mdy), also the integer expression should have the same format.