Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
UppHub
Status & Roadmap
FAQ
Authors & License
Forums
Funding U++
Search on this site











SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo

Date formatting and scanning

 

Global functions

 

const char *StrToDate(Date& d, const char *s)

Scans a string for a Date. Order of day, month and year is specified using SetDateScan. In place of month both number and text is accepted - text must match abbreviated or full name of month.

d

Found date.

s

String to scan.

Return value

NULL if no date is found in s or pointer to character right after the date.

 


 

String Format(Date date, const char *fmt)

Formats date. Date is formated using the standard Format function and the four supplied integer value arguments are year, month, day and day of week.

 


 

String Format(Date date)

Formats date. Date is formated using the standard Format function, where the string set by SetDateFormat is used as formating string, and the four supplied integer value arguments are year, month, day and day of week.

date

Date to format.

Return value

Formatted date.

 


 

int CharFilterDate(int c)

Character filter for dates. Its behaviour is specified by SetDateFilter function.

c

Character to filter.

Return value

Filtered character.

 


 

void SetDateFormat(const char *fmt)

Sets formating string for dates. When used for formatting, there are 3 integer arguments passed to Format with this string. First is year, second is month and third is day. This is per-thread setting with threads inheriting the setting of main thread.

 


 

void SetDateScan(const char *scan)

Sets date scan string - this string represents order of day, month and year for StrToDate function. Letters 'd', 'm' and 'y' are used in scan to designate the order.  This is per-thread setting with threads inheriting the setting of main thread.

Example:

     "mdy"

The month is first, day second and year third.

 


 

void SetDateFilter(const char *seps)

Specifies CharFilterDate behaviour. Digits are always allowed in CharFilterDate. If there is "a" at the beginning of seps string, letters are allowed. If there is "A", letters are allowed and converted to upper-case. After this optional character, list of characters allowed as separator follows. "\r" after character designates "replace" character - if used, all characters up to next "amend" character or '\0' are replaced by it.  This is per-thread setting with threads inheriting the setting of main thread.

Example:

     "a.\r,\r/\r:;"

CharFilterDate would allow letters but not convert them to uppercase, it will allow characters '.' and '/' and it will convert ',' to '.' and ':' or ';' to '/'.

 

 

Do you want to contribute?