GetCurrentDate
string GetCurrentDate(string format)Description
Returns the current local date as a formatted string.
The format parameter uses strftime-style specifiers to define the output layout.
Parameter
- format - A format string using the following specifiers:
| Specifier | Description | Example |
|-----------|-------------|---------|
| %Y | 4-digit year | 2025 |
| %y | 2-digit year | 25 |
| %m | Month (01–12) | 05 |
| %d | Day (01–31) | 08 |
| %B | Full month name | May |
| %b | Abbreviated month name | May |
| %A | Full weekday name | Thursday |
| %a | Abbreviated weekday name | Thu |
| %j | Day of year (001–366) | 128 |
Returns
The current date formatted as a string.
Example
void main()
{
string d1 = GetCurrentDate("%Y-%m-%d"); // e.g. "2025-05-08"
string d2 = GetCurrentDate("%d.%m.%Y"); // e.g. "08.05.2025"
string d3 = GetCurrentDate("%A, %d %B %Y"); // e.g. "Thursday, 08 May 2025"
}