$Id: date-time.xsl 3991 2004-11-10 06:51:55Z balls $
Diamond
Jason
2004
Steve Ball
2001
Jason Diamond
Date/Time Processing
Introduction
This module provides templates for formatting and parsing date/time strings.
See http://www.tondering.dk/claus/calendar.html for more information on calendars and the calculations this library performs.
Returns a string with a formatted date/time.
The formatted date/time is determined by the format parameter. The default format is %Y-%m-%dT%H:%M:%S%z, the W3C format.
xsd-date-time
The date-time value in XML Schemas (WXS) format.
If this value is specified, it takes priority over other parameters.
year
Year, in either 2 or 4+ digit format..
If the year is given as a two digit value, it will be converted to a four digit value using the fixed window method. Values between 00 and 49 will be prepended by "20". Values between 50 and 99 will be prepended by "19".
month
Month (1 - 12; January = 1)
day
Day of month (1 - 31)
hour
Hours since midnight (0 - 23)
minute
Minutes after hour (0 - 59)
second
Seconds after minute (0 - 59)
time-zone
Time zone string (e.g., 'Z' or '-08:00')
format
The format specification.
%a
Abbreviated weekday name
%A
Full weekday name
%b
Abbreviated month name
%B
Full month name
%c
Date and time representation appropriate for locale
%d
Day of month as decimal number (01 - 31)
%e
Day of month as decimal number (1 - 31)
%H
Hour in 24-hour format (00 - 23)
%I
Hour in 12-hour format (01 - 12)
%i
Hour in 12-hour format (1 - 12)
%j
Day of year as decimal number (001 - 366)
%m
Month as decimal number (01 - 12)
%n
Month as decimal number (1 - 12)
%M
Minute as decimal number (00 - 59)
%P
Current locale's A.M./P.M. indicator for 12-hour clock, uppercase
%Q
Current locale's A.M./P.M. indicator for 12-hour clock, uppercase with periods
%p
Current locale's A.M./P.M. indicator for 12-hour clock, lowercase
%q
Current locale's A.M./P.M. indicator for 12-hour clock, lowercase with periods
%S
Second as decimal number (00 - 59)
%U
Week of year as decimal number, with Sunday as first day of week (00 - 53)
%w
Weekday as decimal number (0 - 6; Sunday is 0)
%W
Week of year as decimal number, with Monday as first day of week (00 - 53)
%x
Date representation for current locale
%X
Time representation for current locale
%y
Year without century, as decimal number (00 - 99)
%Y
Year with century, as decimal number
%z
Time-zone name or abbreviation; no characters if time zone is unknown
%%
Percent sign
Returns a formatted date/time string.
%
[not implemented]
0
0
12
0
0
12
[not implemented]
0
0
am
pm
am
p.m.
AM
PM
AM
P.M.
0
[not implemented]
[not implemented]
invalid year value
00
invalid year value
invalid year value
%
Calculates the day of the week.
Given any Gregorian date, this calculates the day of the week.
year
Year
month
Month (1 - 12; January = 1)
day
Day of month (1 - 31)
Returns the day of the week (0 - 6; Sunday = 0).
Calculates the number of days for a specified month.
Given any Gregorian month, this calculates the last day of the month.
year
Year
month
Month (1 - 12; January = 1)
Returns the number of days in given month as a decimal number.
29
28
30
31
30
31
Gets the day of the week's full name.
Converts a numeric day of the week value into a string representing the day's full name.
day-of-the-week
Day of the week (0 - 6; Sunday = 0)
Returns a string.
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
error:
Gets the day of the week's abbreviation.
Converts a numeric day of the week value into a string representing the day's abbreviation.
day-of-the-week
Day of the week (0 - 6; Sunday = 0)
Returns a string.
Sun
Mon
Tue
Wed
Thu
Fri
Sat
error:
Gets the month's full name.
Converts a numeric month value into a string representing the month's full name.
month
Month (1 - 12; Januaray = 1)
Returns a string.
January
February
March
April
May
June
July
August
September
October
November
December
error:
Gets the month's abbreviation.
Converts a numeric month value into a string representing the month's abbreviation.
month
Month (1 - 12; Januaray = 1)
Returns a string.
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
error:
Calculates the Julian Day for a specified date.
Given any Gregorian date, this calculates the Julian Day.
year
Year
month
Month (1 - 12; January = 1)
day
Day of month (1 - 31)
Returns the Julian Day as a decimal number.
Returns a string with a formatted date for a specified Julian Day.
Given any Julian Day, this returns a string according to the format specification.
julian-day
A Julian Day
format
The format specification. See dt:format-date-time for more details.
A string.
Calculates the week number for a specified date.
Assumes Monday is the first day of the week.
year
Year
month
Month (1 - 12; January = 1)
day
Day of month (1 - 31)
Returns the week number as a decimal number.
Take a month by name and return a number which can be used as input to the templates.
Input
month
Month as described either by full name or abbreviation.
Return a month as a decimal number. (Jan = 1)
Return year component of XSD DateTime value.
Extract component of XML Schemas DateTime value.
xsd-date-time
A value in XSD DateTime format.
Returns year component.
Return month component of XSD DateTime value.
Extract component of XML Schemas DateTime value.
xsd-date-time
A value in XSD DateTime format.
Returns month component.
Return day component of XSD DateTime value.
Extract component of XML Schemas DateTime value.
xsd-date-time
A value in XSD DateTime format.
Returns day component.
Return hour component of XSD DateTime value.
Extract component of XML Schemas DateTime value.
xsd-date-time
A value in XSD DateTime format.
Returns hour component.
Return minute component of XSD DateTime value.
Extract component of XML Schemas DateTime value.
xsd-date-time
A value in XSD DateTime format.
Returns minute component.
Return second component of XSD DateTime value.
Extract component of XML Schemas DateTime value.
xsd-date-time
A value in XSD DateTime format.
Returns second component.
Return timezone component of XSD DateTime value.
Extract component of XML Schemas DateTime value.
xsd-date-time
A value in XSD DateTime format.
Returns timezone component.
Z
+
-
Return two digit year as four digit year value.
Prepend century to two digit year value.
Century value is calculated according to suggested solutions in RFC2626 (section 5).
Fixed window solution: 20 is prepended to year if the year is less than 50, otherwise 19 is prepended to year.
Sliding window solution: The year is considered in the future if the year is less than the current 2 digit year plus 'n' years (where 'n' is a param), otherwise it is considered in the past.
year
A year value in 2 digit format.
method
RFC2626 suggested solution ('fixed' or 'sliding'). Default is 'fixed'.
n
No. of years. Used in sliding windows solution.
Returns four digit year value.
invalid year value
20
19
not yet implemented
invalid method