Formatting Dates

By Michael Slater, Posted 07/04/09     Add your comments

Webvanta stores dates and time in a format-independent representation, and you can choose the format when you display it. The format string uses the "strftime" format that has been used in many languages.

Webvanta stores dates and time in a format-independent representation, and you can choose the format when you display it.

The format string uses the "strftime" format that has been used in many languages. These are the options:

%aThe abbreviated weekday name ("Sun")
%AThe full weekday name ("Sunday")
%bThe abbreviated month name ("Jan")
%BThe full month name ("January")
%cThe preferred local date and time representation
%dDay of the month (01..31)
%eDay of the month without leading zeroes (1..31)
%HHour of the day, 24-hour clock (00..23)
%IHour of the day, 12-hour clock (01..12)
%jDay of the year (001..366)
%kHour of the day, 24-hour clock w/o leading zeroes ( 0..23)
%lHour of the day, 12-hour clock w/o leading zeroes ( 1..12)
%mMonth of the year (01..12)
%MMinute of the hour (00..59)
%pMeridian indicator ("AM" or "PM")
%PMeridian indicator ("am" or "pm")
%SSecond of the minute (00..60)
%UWeek number of the current year, starting with the first Sunday as the first day of the first week (00..53)
%WWeek number of the current year, starting with the first Monday as the first day of the first week (00..53)
%wDay of the week (Sunday is 0, 0..6)
%yYear without a century (00..99)
%YYear with century
%ZTime zone name
%zTime zone expressed as a UTC offset ("-04:00")
%%Literal "%" character

Any text in the format string that is not preceded by a % symbol is rendered as ordinary text.

Here are some examples:

<w:date format="%A %B %e, %Y %l:%M %P" /> Saturday July 4, 2022 1:32 pm
<w:date format="%a %b %e '%y %k:%M" /> Sat Jul 4 '09 13:32
<w:date format="%m/%e/%Y" /> 07/4/2022

Add Your Comment

(not published)