strdate
The strdate function converts a datetime type into a string using a format that you specify. This function enables you to include static characters such as a slash (/), which gives you access to full date support.
Syntax
Use this syntax:
strdate(datetime,"format",string);
where:
datetime – datetime variable (month specified as 1-12)
format – date format
string – string variable
Example
An example of this function follows:
datetime d;
string[8] s;
strdate(d,"%y/%m/%d",s);
//Converts a datetime variable into an eight character string in the
//format "year/month/day".
Format Specifiers
The following list describes the format specifiers:
- Format Specifier
- Description
- %a
- Abbreviated weekday name.
- %A
- Full weekday name.
- %b
- Abbreviated month name.
- %B
- Full month name.
- %d
- Day of the month as a decimal number (01 - 31).
- %D
- Hundredths of a second as a decimal number (00 - 99).
- %H
- Hour in 24-hour format (00 - 23).
- %I
- Hour in 12-hour format (01 - 12).
- %j
- Day of the year as a decimal number (001 - 365).
- %j%y
- Day of a leap year as a decimal number (001-366).
- %m
- Month as a decimal number (01 - 12).
- %M
- Minute as a decimal number (00 - 59).
- %S
- Second as a decimal number (00 - 59).
- %U
- Week of the year as a decimal number, with Sunday as the first day of the week (00 - 51).
- %w
- Weekday as a decimal number (0 - 6, with Sunday as “0”).
- %W
- Week of the year as a decimal number, with Monday as the first day of the week (00 - 51).
- %y
- Year without the century as a decimal number (00 - 99).
- %Y
- Year with the century as a decimal number.
- %%
- Percent sign.