home *** CD-ROM | disk | FTP | other *** search
- *********
- * Function : CDTOS
- * By : Tom Rettig
- * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- *********
-
-
- FUNCTION CDTOS
- * Syntax: CDTOS( <expC date>, <format> )
- * Return: <date string> in the DTOS() format "YYYYMMDD" of <expC date>
- * Note : <format> is specified as Y for year, M for month, and D for date
- * <format> must be same len as <expC date> and contain
- * delimiters in the same positions
- * Current century is assumed if 2 digit year
- * Does not trap invaild entry.
- * Examples:
- * CDTOS( "122586", "MMDDYY" )
- * CDTOS( "86/12/25", "YY/MM/DD" )
- * CDTOS( "25.12.1986", "DD.MM.YYYY" )
- *
- PARAMETERS tr_date, tr_format
- MEMVAR tr_yearlen
- PRIVATE tr_yearlen
- tr_format = UPPER(tr_format)
- tr_yearlen = CHRCOUNT("Y",tr_format)
- RETURN IF(tr_yearlen=2, SUBSTR(STR(YEAR(DATE()),4),1,2), []) +;
- SUBSTR( tr_date,AT("Y",tr_format), tr_yearlen ) +;
- SUBSTR( tr_date,AT("M",tr_format), 2 ) +;
- SUBSTR( tr_date,AT("D",tr_format), 2 )
- * eofunc cdtos
-
-
-