Convert a text string that represents date/time into a Julian date value, using system date time format
double str_to_date( LPCSTR lpcsz, int nFmt = LDF_SHORT, LPCSTR lpcszCustom = NULL )
A no-missing double value represent a Julian date if success, else a missing value
EX1
void str_to_date_ex1() { //custom format string strDate = "2009-4-25 17:59:59"; double dt = str_to_date(strDate, LDF_OBJ_CUSTOM, "yyyy-MM-dd HH:mm:ss"); //default format is LDF_SHORT string strShort = get_date_str(dt, LDF_SHORT);//OS System's short format, by default it's "M/d/yyyy" if the OS is U.S region double db = str_to_date(strShort); if(!is_missing_value(db)) { printf("%s = %g\n", strShort, db); } else out_str("the string is not recorgnized as a date string"); //LDF_YYMMDD_AND_HHMMSS string strYMDHMS = get_date_str(dt, LDF_YYMMDD_AND_HHMMSS); db = str_to_date(strYMDHMS, LDF_YYMMDD_AND_HHMMSS); if ( is_missing_value(db) ) out_str("Fail to convert string to date"); else printf("%s = %g\n", strYMDHMS, db); }
get_date_str, str_to_date_custom
origin.h