KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Converting dates to numbers and vice versa
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: July 15, 2003

Versions: 6.7, 6.8 and 2003

This tech tip provides you with two simple methods that will perform a conversion between a date and numeric value.

Converting a date to a numeric value (Longint):

  ` Project Method: DateToNum
C_LONGINT($0)
C_DATE($1;$date)
$date:=$1
$0:=$date-!00/00/00!

- Converting a numeric value (Longint) to a date:

  ` Project Method: NumToDate
C_LONGINT($1)
C_DATE($0;$date)
$date:=!01/01/01!+$1
$0:=$date-(!01/01/01!-!00/00/00!)