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

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

Versions of this function that are not passed a pointer to a datetime_struct return 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

Last modified 4 years ago Last modified on 01/29/21 11:09:57
Note: See TracWiki for help on using the wiki.