C_DATE_R module routines - WIN32

Company Information Software Products TDF Market Reports Download Area take me Home

C_DATE_R.C - Convert and validate DATE Routines.

Date formats supported are MM/DD/YY, European DD/MM/YY, and YYMMDD strings, YYMMDD floats and UWORD julians. There are conversion routines to do any translation. The julian conversion routines are in the julian module J_DATE_R.C.

This module has also been updated to support year 2000 issues. A LONG YYYYMMDD format has been added with a collection of conversion routines. Since a single precision IEEE float only has 7 digits of accuracy 1900 - 1999 dates are mapped to 00-99 and 2000+ dates are mapped to YYYY - 1900.

Function validate_date_field
Include file C_DATE_R.H
Prototype int validate_date_field( char *date_field )
Remarks Front-end to validate_MM_DD_YY. This routine supports lazy user input, given MM/DD the routine will add the current year. The year is saved and carried over from call to call so you could enter 11/12/91 then 11/13 and have 91 added on. The modified str is then checked by validate_MM_DD_YY.

Function validate_MM_DD_YY
Include file C_DATE_R.H
Prototype int validate_MM_DD_YY( char *date_str )
Remarks Validate the month and day fields of a MM/DD/YY date str. Return TRUE if valid else FALSE (all INVALID - 2/29/83 | 14/02/91 | 10/44/99 ).

Function cnvt_MM_DD_YY_2_flt
Include file C_DATE_R.H
Prototype float cnvt_MM_DD_YY_2_flt( char *date_str )
Remarks Convert a MM/DD/YY date string into a float of YYMMDD.

Function cnvt_MM_DD_YY_2_YYYYMMDD
Include file C_DATE_R.H
Prototype LONG cnvt_MM_DD_YY_2_YYYYMMDD( char *date_str )
Remarks Convert a MM/DD/YY date string into a LONG of YYYYMMDD.

Function cnvt_DD_MM_YY_2_flt
Include file C_DATE_R.H
Prototype float cnvt_DD_MM_YY_2_flt( char *date_str )
Remarks Convert a European style DD/MM/YY date string into a float of YYMMDD.

Function get_date_substr
Include file C_DATE_R.H
Prototype static char *get_date_substr( char *src , char *dest )
Remarks Simple worker parse routine for cnvt_MM_DD_YY_2_flt.

Function cnvt_YYMMDD_flt_2_MM_DD_YY
Include file C_DATE_R.H
Prototype char * cnvt_YYMMDD_flt_2_MM_DD_YY( float flt_date )
Remarks Convert a YYMMDD float into a MM/DD/YY date string.

Function cnvt_YYMMDD_flt_2_DD_MM_YY
Include file C_DATE_R.H
Prototype char * cnvt_YYMMDD_flt_2_DD_MM_YY( float flt_date )
Remarks Convert a YYMMDD float into a Euro style DD/MM/YY date string.

Function cnvt_YYMMDD_str_2_flt
Include file C_DATE_R.H
Prototype float cnvt_YYMMDD_str_2_flt( char *date_str )
Remarks Convert a YYMMDD date str into a YYMMDD float.

Function cnvt_YYMMDD_str_2_MM_DD_YY
Include file C_DATE_R.H
Prototype char * cnvt_YYMMDD_str_2_MM_DD_YY( char *date_str )
Remarks Convert a YYMMDD date str into a MM/DD/YY date str

Function cnvt_MM_DD_YY_2_YYMMDD_str
Include file C_DATE_R.H
Prototype char * cnvt_MM_DD_YY_2_YYMMDD_str( char *date_str )
Remarks Convert a MM/DD/YY date str into a YYMMDD date str

Function cnvt_YYMMDD_flt_2_YYYYMMDD
Include file C_DATE_R.H
Prototype LONG cnvt_YYMMDD_flt_2_YYYYMMDD( float flt_date )
Remarks Convert a YYMMDD float date into a YYYYMMDD LONG date. Will map YY = 50 - 99 to 19??, 0 - 49 to 20?? and 100 - 199 will have 1900 added so they will map to 2000 - 2099 (exp. 1031122.0 or 31122.0 -> 20031122).

Function cnvt_YYYYMMDD_2_YYMMDD_flt
Include file C_DATE_R.H
Prototype float cnvt_YYYYMMDD_2_YYMMDD_flt( LONG long_date )
Remarks Convert a LONG YYYYMMDD date into a YYMMDD (or maybe YYYMMDD) float date. Dates in 1900's return as 00-99, dates in 2000+ return as 100+ (exp. 20031122 -> 1031122.0 ).

Function cnvt_YYYYMMDD_2_YYMMDD_str
Include file C_DATE_R.H
Prototype char * cnvt_YYYYMMDD_2_YYMMDD_str( LONG long_date )
Remarks Convert a YYYYMMDD LONG date into a YYMMDD date str. Will just chop the YYYY (2001) into YY (01). Useful for 6 digit report fields.

Function cnvt_YYMMDD_flt_2_YYMMDD_str
Include file C_DATE_R.H
Prototype char * cnvt_YYMMDD_flt_2_YYMMDD_str( float flt_date )
Remarks Convert a YYMMDD float date into a YYMMDD date str

Function constant_length_date
Include file C_DATE_R.H
Prototype char * constant_length_date( char *date_str )
Remarks Well not quite any more - expand day and month fields to 2 digits and return the year field un-touched.

Function get_field_from_YYMMDD_flt
Include file C_DATE_R.H
Prototype int get_field_from_YYMMDD_flt( float flt_date , int which_field )
Remarks Fetch a field from a YYMMDD float style date and return it as an int. This routine is front-ended by 3 macros to fetch each individual field. The macros just need a date as a argument. They are defined in C_DATE_R.H and are get_YY_from_YYMMDD_flt( fd ), get_MM_from_YYMMDD_flt( fd ) and get_DD_from_YYMMDD_flt( fd )..

Table of Contents Function Index

generated on 22 September 1998 - 12:54:41
© 1998 Tierra del Fuego Ltd.