2.1.8.38 systemtime_to_date_str
Description
Convert a SYSTEMTIME structure to a formatted string.
Syntax
BOOL systemtime_to_date_str( SYSTEMTIME * pSysTime, LPSTR lpstr, WORD wFormat = LDF_SHORT )
Parameters
- pSysTime
- [input] pointer to the source SYSTEMTIME structure. See tm_to_systemtime about this structure.
- lpstr
- [output] pointer to the buffer to receive the formatted string
- wFormat
- [input] a date format flag to determine the appearance of the formatted string.
- These includes: LDF_SHORT, LDF_LONG, LDF_ALPHAMONTH_NUMERICDAY, LDF_NUMERICMONTH_NUMERICDAY,
- LDF_NUMERICDAY, LDF_ALPHAWEEKDAY_3CHR, LDF_ALPHAWEEKDAY_1CHR, LDF_NUMERICYEAR_4DIGIT,
- LDF_NUMERICYEAR_2DIGIT, LDF_SHORT_AND_HHMM_SEPARCOLON, LDF_SHORT_AND_HHMMSS_SEPARCOLON,
- LDF_YYMMDD, LDF_YYMMDD_AND_HHMM_SEPARCOLON, LDF_YYMMDD_AND_HHMMSS_SEPARCOLON,
- LDF_YYMMDD_AND_HHMM, LDF_YYMMDD_AND_HHMMSS, LDF_ALPHAMON_3CHR, LDF_ALPHAMON_1CHR,
- LDF_QUARTER, LDF_CUSTOM1, LDF_CUSTOM2 .
- See the definitions of LDF_* in OC_Const.h .
Return
If successful then TRUE else FALSE
Examples
EX1
// This is a self contained sample program for the function systemtime_to_date_str,
// To run the program, enter the following command in the Script window:
// systemtime_to_date_str_ex1
void systemtime_to_date_str_ex1()
{
SYSTEMTIME SysTime;
char lpstr[100];
BOOL rc;
GetSystemTime(&SysTime); // gets current date and time,
WORD wFormat=LDF_CUSTOM1;
rc=systemtime_to_date_str(&SysTime,lpstr,wFormat); // Demonstration of systemtime_to_date_str
if(rc)
printf("Today's date & time in your Origin custom date format(1) = \"%s\"\n",lpstr);
else
printf("Error: systemtime_to_date_str failed.");
}
Remark
See Also
Header to Include
origin.h
Reference
|