2.1.8.5 date_to_str_custom


Description

Convert a Julian date value to a string formatted according to that represents date/time

Syntax

BOOL date_to_str_custom( double rDate, LPCSTR lpcszFormatStr, LPSTR lpszDateStr )

Parameters

rDate
Julian date value
lpcszFormatStr
[input] pointer to a format picture string that is used to form the date string
lpszDateStr
[output] pointer to the target buffer

Return

If successful then TRUE else FALSE

Examples

EX1

void date_to_str_custom_ex1()
{
    string strDateIn = "2003-03-21";
    string strFormat = "yyyy'-'MM'-'dd";
    char szDateOut[MAXLINE];
    double db;
    
    if( str_to_date_custom(strDateIn, strFormat, &db) )
    {
        if( date_to_str_custom(db, strFormat, szDateOut) )
        {
            if( !strDateIn.CompareNoCase(szDateOut) )
                printf("success\n"); // date_to_str_custom gets what str_to_date_custom puts
            else
                printf("failure\n"); // date_to_str_custom did not get what str_to_date_custom put
        }
    }
}

Remark

See Also

str_to_date_custom

Header to Include

origin.h

Reference