Home > Basic Time Information > Calendar > Calendars > Julian / Gregorian Calendar (Expression Format)

Julian / Gregorian Calendar (Expression Format)

How to specify format

Input and output format is specified with format specifiers and other characters. Additional specifiers relating with century and years in B.C. can be used for Julian / Gregorian Calendar.

e.g. When output format for Gregorian calendar is specified as yyyy-MM-dd (C'c'), date of 1 April in 2013 is displayed as 2013-04-01 (21c).

Format Specifiers

Century

Entered characters expressing century are not used for calendar calculation, though they are interpreted according to the format. Characters expressing year are essential.

cc In/Out A more than two digits number expressing century is interpreted or displayed. 1st century A.D. is 01, 1st century B.C. is 00 and 2nd century B.C. is -01. +-sign is not counted as the digits.
Input: Add 0 to the top when the century number is between -9 and 9. A more than two digits number is interpreted until non-digit character appears.
Output: When the century number is between -9 and 9, 0 is added to the top. The century of less than -100 or more than 100 is displayed as it is.
c In/Out A number expressing century is interpreted or displayed. 1st century A.D. is 1, 1st century B.C. is 0 and 2nd century B.C. is -1.
ca In Function is the same of specifier c. This is prepared to maintain compatibility between calendars.
CC In/Out A more than two digits number expressing century with era is interpreted or displayed. 1st century A.D. is 01, 1st century B.C. is 01 and 2nd century B.C. is 02. +-sign is not acceptable.
Input: Add 0 to the top when the century number is less than 9. A more than two digits number is interpreted until non-digit character appears.
Output: When the century number is less than 9, 0 is added to the top. The century of more than 100 is displayed as it is.
C In/Out A number expressing century with era is interpreted or displayed. 1st century A.D. is 1, 1st century B.C. is 1 and 2nd century B.C. is 2.
Ca In Function is the same of specifier C. This is prepared to maintain compatibility between calendars.

Era

gg In/Out Characters expressing era are interpreted of displayed. Before Christ is "B.C." and Anno Domini is "A.D.". Specifier gg have to be used with specifier YYYY, YY, Y or Ya (input only) for year. When specifier for era is omitted, the year is interpreted as in A.D. era.

Year

yyyy In/Out A more than four digits number expressing year is interpreted or displayed. +-sign is not counted as the digits. Year 1 A.D. is 0001, 1 B.C. is 0000 and 2 B.C. is -0001.
Input: A less than three digits number is not acceptable. Add 0 to the top when the year number is between -999 and 999. A more than five digits number is interpreted until non-digit character appears.
Output: When the year number is between -999 and 999, add 0s to the top. The year of less than -10000 or more than 10000 is displayed as it is.
yy In/Out A two digits number expressing year is interpreted or displayed. Year 1 A.D. is 01, 1 B.C. is 00 and 2 B.C. is -01.
Input: A one digit number is not acceptable. Add 0 to the top when the year number is between -9 and 9. For a more the three digits number, the first and the second digits are interpreted as the year and the third and later digits are interpreted as other characters for the next format. Number less than 29 is interpreted as a year in 2000s A.D., and number more than 30 is interpreted as a year in 1900s A.D.
Output: Only lower two digits are displayed even though the year is more than 100. When the number is less than 10, 0 is added to the top.
y In/Out A number expressing year is interpreted or displayed. Year 1 A.D. is 1, 1 B.C. is 0 and 2 B.C. is -1. A number expressed according to yyyy format (e.g. 0794) is also acceptable.
Input: Characters are interpreted as the year until non-digit character appears.
Output: A number expressing the year is displayed as it is.
ya In Function is the same of specifier y. This is prepared to maintain compatibility between calendars.
YYYY In/Out A more than four digits number expressing year with era is interpreted or displayed. +-sign is not acceptable. Year 1 A.D. is 0001, 1 B.C. is 0001 and 2 B.C. is 0002.
Input: A less than three digits number is not acceptable. Add 0 to the top when the year number is less than 999. A more than five digits number is interpreted until non-digit character appears. When specifier for era is omitted, the year is interpreted as in A.D. era.
Output: When the year number is less than 999, add 0s to the top. The year of more than 10000 is displayed as it is.
YY In/Out A two digits number expressing year with era is interpreted or displayed. +-sign is not acceptable. Year 1 A.D. is 01, 1 B.C. is 01 and 2 B.C. is 02.
Input: A one digit number is not acceptable. Add 0 to the top when the year number is less than 9. For a more the three digits number, the first and the second digits are interpreted as the year and the third and later digits are interpreted as other characters for the next format. The year is not interpreted as a year in 1900s or 2000s A.D., but is interpreted as it is. The function is different from that of specifier yy.
Output: Only lower two digits are displayed even though the year is more than 100. When the number is less than 10, 0 is added to the top.
Y In/Out A number expressing year with era is interpreted or displayed. Year 1 A.D. is 1, 1 B.C. is 1 and 2 B.C. is 2. A number expressed according to YYYY format (e.g. 0794) is also acceptable.
Input: Characters are interpreted as the year until non-digit character appears. When specifier for era is omitted, the year is interpreted as in A.D. era.
Output: A number expressing the year is displayed as it is.
Ya In Function is the same of specifier Y. This is prepared to maintain compatibility between calendars.

Month

MMMM In/Out Characters expressing month name is interpreted or displayed.
MMM In/Out Characters expressing abbreviated month name is interpreted or displayed.
MM In/Out A two digits number expressing month is interpreted or displayed.
Input: Only a two digit number is acceptable. Add 0 to the top, when the month number is less than 9.
Output: A two digits number is displayed. When the month number is less than 10, 0 is added to the top.
M In/Out A number expressing month is interpreted or display.
Input: Up to two characters are interpreted as the month number if the character is digit. A number expressed according to MM format (e.g. "05") is also acceptable.
Output: Month number is displayed as it is.
Ma In Ma is a wildcard character for interpretation, and shows characters to match specifier MMMM, MMM or M.

Day of Month

dd In/Out A two digits number expressing day of month is interpreted or displayed.
Input: Only a two digit number is acceptable. Add 0 to the top, when the day number is less than 9.
Output: A two digits number is displayed. When the day number is less than 9, 0 is added to the top.
d In/Out A number expressing day of month is interpreted or displayed.
Input: Up to two characters are interpreted as the day number, if the characters are digit. A number expressed according to dd format (e.g. "08") is also acceptable.
Output: Day number is displayed as it is.
da In Function is the same of specifier d. This is prepared to maintain compatibility between calendars.

Other Specifiers

* Input * is a wildcard character for interpretation, and shows any characters or null (equal to .* in regular expression). Characters in the entered text string are skipped until characters which match to the next specifier appear. This specifier cannot be placed top of the format.
? In ? is a wildcard character for interpretation, and shows any one character. This specifier cannot be placed top of the format.
" In/Out Characters quoted with " do not work as specifiers, and interpreted or displayed as the characters themselves. " itself can be expressed as '"' or \".
' In/Out Characters quoted with ' do not work as specifiers, and interpreted or displayed as the characters themselves. ' itself can be expressed as "'" or \'.
\ In/Out \ is an escape character. A character after \ do not work as specifiers, and interpreted or displayed as the character itself. \ itself can be expressed as \\.