wiki:Docs/Prog/Manual/ApplicationLibraries/lib825ev/Time/GetDateStr

Version 6 (modified by Don Wilson, 4 years ago) ( diff )

--

GetDateStr

Get the date

string GetDateStr(void);

char* GetDateStr(char* pszBuffer);

string GetDateStr(datetime_struct* pDate);

char* GetDateStr(datetime_struct* pDate, char* pszBuffer);

Parameters

  • pszBuffer - buffer to hold formatted time, application must insure that this buffer is large enough.
  • pDate - pointer to datetime_struct

Return Value

  • Returns the date formatted as "MM/DD/YYYY" or "DD/MM/YYYY", or "YYYY-MM-DD", based on boot loader preferences.

Remarks

This function returns the date information that is in memory based on a previous call to GetLinuxTime() or IsTimeChanged(). The versions of this function that take a datetime_struct pointer may be used to format date string based on an arbitrary date.

Examples

string strDate = GetDateStr();
DisplayText(10, 10, strDate);
char szDate[20];
GetDateStr(szDate);
DisplayText(10, 10, szDate);
datetime_struct dt;
dt.year = 2021;
dt.month = 1;
dt.day = 28;

string strDate = GetDateStr(&dt);
DisplayText(10, 10, strDate);
datetime_struct dt;
dt.year = 2021;
dt.month = 1;
dt.day = 28;

char szDate[20];

GetDateStr(&dt, szDate);

DisplayText(10, 10, szDate);

See Also

Note: See TracWiki for help on using the wiki.