![]() ![]() ![]() ![]() |
| Topics this page: |
|
|
Standard | Sample Values | Format & Notes |
---|---|---|
Email ISO8601 |
1997-07-16T19:20:30+0100 or 2004-07-16T19:20:30Z | Format: "Y-m-d\\TH:i:sO" +01:00 means that the time zone is 1 hour ahead of GMT/UTC. Z after the time means GMT/UTC |
W3C ATOM RSS |
1997-07-16T19:20:30+01:00 or 2004-07-16T19:20:30Z | Format: "Y-m-d\\TH:i:sP" +01:00 means that the time zone is 1 hour ahead of GMT/UTC. Z after the time means GMT/UTC |
RFC822 |
Tue, 23 Sep 2003 13:21:00 GMT | Format: "D, d M Y H:i:s O" -07:00 means that the time zone is 7 hours behind GMT/UTC. GMT means GMT/UTC. There are other written time zone settings. |
UNIX |
1121453661![]() | Number of seconds since the epoch. |
C | Sun Apr 21 15:31:06 2002 | - |
Java | Sun May 25 19:58:02 PDT 2003 | From var now = new Date(); |
MS VB | 1/19/2003 11:39:00 PM | now()![]() |
MS SQL CSV | 1998-12-31 23:59:59.999 | The format within CSV (text) files input into Microsoft SQL Server databases. |
Whidbey | 2003-10-26T14:33:41.1234567Z | Contains a Z for time zone. public string StoreDateTime(DateTime value) { return DateTime.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ", CultureInfo.InvariantCulture); |
| ![]() ![]() ![]() |
| Related: Javascript formatDate function ala PHP
| ![]() ![]() ![]() |
|
Language | BC | AD |
---|---|---|
French | avJC for avant (for before) Jesus Christ | apJC for apres (after) Jesus Christ. |
German | vChr or vChrG for vor (before) Christi Geburt (birth) | nChr or nChrG for nach (after) Christi Geburt. |
Italian | aC for avanti (before) Cristo | dC for dopo (after) Cristo. |
Spanish | a.C. for avant Christos (before) Christ | d.C. for dopo Christos (after) Christ. |
Finnish | eKr for ennen Kristuksen syntymaa (before Christ's birth) | jKr for jalkeen Kristuksen syntyman (after Christ's birth) |
Swedish | fKr for fore (before) Kristus; and | eKr for efter (after) Kristus although the Latin "AD" is used in religious texts. |
Dutch | vC or vChr for voor (before) Christus | AD, anno Domini (the Latin). |
In the 1950's, academics who wanted a secular name (more politically correct to those who deny Christ) invented the word "Common Era" (abbreviated to "CE") for use instead of "AD", with "BCE" (for Before the Common Era) instead of "BC".
The current Japanese calendar era began at Heisei 1 in early 1989 upon accession of the current Emperor to the throne.
The Hebrew calendar [W] began October 7 3761 BCE
Megalomanics (such as Mugabi of Uganda and Kim Il-Sung of North Korea) established their country's calendar to start on their birthdays.
The traditional Chinese calendar [W] era begins from the reign of the Yellow Emperor on 2698 BC. But since different Western writers also date the event at 2637 BC or 2697 BC, the Gregorian year 2000 coincides with Chinese years 4637, or 4698 as well as the most common 4697.
| ![]() ![]() ![]() |
|
Type | Epoch |
---|---|
On PC software (just as on most other systems) | January 1, 1900 |
On Mac software (don't get me started on the problems this causes!) | January 2, 1904 |
Negative values are used to store dates before the epoch.
A zero value in a PC's date field would be midnight, December 30, 1899.
To avoid possible confusion with Microsoft Excel's differrent epochs,
input dates using Excel function:
=DATE(2006, 4, 5)
or this function:
=DATEVALUE("4/5/2006")
Cells containing these functions appear as numbers when referenced.
Microsoft SQL has two data types using two different epochs: |
Data Type | Minimum (Epoch) | Maximum | Precision |
---|---|---|---|
datetime | Jan 1, 1753 midnight | Dec 31, 9999 23:59:59.997 (0.003 seconds until midnight) | To the nearest 3.33 milliseconds |
smalldatetime | Jan 1, 1900 midnight | Jun 6, 2079 23:59 (1 minute until midnight) | To the nearest minute |
Microsoft SQL does not provide separate variables for date and time
because time values are a fraction of the incremental date epoch value.
Because time values are approximate numerics, queries should search ranges of datetime values. A date without decimals is assumed to be 0.0.
WHERE DateVal BETWEEN '2002-02-28' AND '2002-02-28 23:59:59.997'
WHERE DateVal >= '2002-02-28' AND DateVal < '2002-02-29'
However, MS-Access users need to use special delimiters for dates:
Bryan Syverson suggests that applications that search for portions of a date/time column
(such as for a specific year or hour)
would have improved performance if a single date/time column is split into two or more separate columns
so that they can each be indexed.
So, at the time the database is designed, each date/time column should be identified as to whether it will store both dates and times, dates only, or times only.
Microsoft SQL does not provide separate variables for date and time.
Timestamps from Unix machines and Java programs are based on the number of seconds
since the beginning epoch of January 1, 1970 at midnight 00:00:00 GMT (Greenwich Mean Time) |
| ![]() ![]() ![]() |
In C# from here:
public long GetEpochTime() { DateTime dtCurTime = DateTime.Now; DateTime dtEpochStartTime = Convert.ToDateTime("1/1/1970 8:00:00 AM"); TimeSpan ts = dtCurTime.Subtract(dtEpochStartTime); long epochtime; epochtime = ((((((ts.Days * 24) + ts.Hours) * 60) + ts.Minutes) * 60) + ts.Seconds); return epochtime; }
|
Item | Description | PHP | C, CGI | ASP | VBA | Oracle | Java | .NET |
---|---|---|---|---|---|---|---|---|
Date | Full date string “01/01/01” | %D | .SHORT | |||||
Year | 4 digit Year with century (1998 or 2003) | %Y | %Y | yyyy | RRRR, IYYY | yyyy | yyyy | |
2 digit Year without century (98 or 03) | %y | yy | RR | IY | yy | yy | ||
1,3 digit Year (3 for 2003) | I,IYY | y | ||||||
Era (BC/AD) | BC,B.C., AD,A.D. | G | gg | |||||
Quarter of Year (1-4) JAN-MAR=1 | Q | |||||||
Month | Month as a decimal (02) | m | %m | %m | MM | MM | MM | MM |
Month without leading zero (2) | n | %j | M | M | ||||
Abbreviated month name (Feb) | M | %b, %h | %b | MMM | MON | MMM | MMM | |
Full month name (February) | F | %B | %B | MMMM | MONTH | MMMMM | MMMM | |
Week | Week in Month (1-5) | W | ||||||
Day of Week![]() | %w | %W | D | E | ||||
Abbreviated day name (Fri) | D | %a | %a | ddd | EEE | ddd | ||
Weekday Name (Friday) | l | %A | %A | dddd | DAY | dddd | ||
ISO Week of Year (1 - 52) | %U, %W | IW | w | |||||
Day of Week in Month (2nd Wed in May) | F | |||||||
Day | Day of the month (03) | d | %d | %d | dd | DD | dd | dd |
Day without leading zero (3) | j | %e | d | d | ||||
Ordinal of day of month (eg st or rd or nd) | S | %O | ||||||
Day of Year (1 to 365) | %j | %j | DDD | D | ||||
Time | 12 hour string (“08:17:59 AM”) | %r | .MEDIUM | |||||
24 hour string (“23:17:59”) | %T | |||||||
Hour in 24 hour format (24) | G | %H | %H | HH24 | k | H,HH | ||
Hour in 12 hour format (03) | g | %I | %h | HH | HH,HH12 | K | h,hh | |
Minute of hour as an integer (01) | i | %M | %N | mm | MI | mm | m,mm | |
Minute as optional if minute <> 0 | %n | |||||||
Second in minute (55) | s | %S | %S | SS | ss | ss | ||
Second in minute with no leading zero (5) | %S | %S | SS | ss | s | |||
MicroSeconds within seconds (600) | SSS | fff | ||||||
AM/PM Indicator (PM)![]() | a A | %p | %P | AM | AM,A.M. PM,P.M. | aaa | tt | |
First character of AM/PM designator | t | |||||||
Time Zone (PDT, PST, etc.) | %Z | z | ||||||
Time Zone offset from GMT | O | z,zz |
In the table here, under the C, CGI column are formatting tokens used by the ANSI C strftime function #config and #timefmt Token Codes.
The VBA column holds the format option used in Microsoft Word menu Insert > Field... > Date and Time > SaveDate > Options... > Add to Field
To convert VB into Java format: Sun May 25 19:58:02 PDT 2003
Format(Now, "ddd MMM dd hh:mm:ss ??? yyyy")
To provide more granular control of date formats than what is generated by VB6's
Obtaining the Dates for Daylight and Standard Time Changes
The Oracle column lists the format mask codes used in the date_format_mask used in this function:
The Java column lists the DateFormat codes modifying internationalized functions getDateInstance and getTimeInstance from package java.util.* used by code such as this:
Date today;
String dateOut; timeOut;
DateFormat dateFormatter;
DateFormat timeFormatter;
dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT,
currentLocale);
timeFormatter = DateFormat.getTimeInstance(DateFormat.DEFAULT,
currentLocale);
today = new Date();
dateOut = dateFormatter.format(today);
System.out.println(dateOut + " " + timeOut + " for " currentLocale.toString());
The list of literals used to designate pattern strings:
C# .NET has dates of different pre-set sizes:
| ![]() ![]() ![]() |
PL/SQL functions use the National Language Set (NLS) date format:
| ![]() ![]() ![]() |
formattedDate = DateTime.Today.DayOfWeek.ToString(); From Winrunner's CSO2LIB Function Generator category csofunctions2: get_dow( "12/31/1999", text); In Oracle PL/SQL, to return the name of the next day from date x given: NEXT_DAY(x)
|
vbSunday 1 (default) vbMonday 2 vbTuesday 3 vbWednesday 4 vbThursday 5 vbFriday 6 vbSaturday 7 ISO 8601 and UNI 7180-73 standards has the day of week beginning on Monday.
| ![]() ![]() ![]() |
public enum TimeOfDay ( Morning = 0; Afternoon = 1; Evening =2; }Then to output the string "Afternoon": TimeOfDay time = TimeOfDay.Afternoon; Console.WriteLine(time.ToString());
|
| ![]() ![]() ![]() |
|
| ![]() ![]() ![]() |
![]() "S&H (Stephenson and Houlden's 1986 theory) curve is probably closest to the truth." Anyway, eventually people noticed that "spring" actually started in late autumn weather. So in 1582 AD Pope Gregorius XIII declared that the day after 4 October 1582 should be 15 October 1582, eliminating the 10 days to set the Vernal Equinox again at 21 March. Since it would be difficult for everyone to adjust their watches an odd amount gradually during the year, we occassionally add a day to the last day in Feburary on a leap year . This happen about every four years, since:
To adjust for that "little under" part, years divisible by 400 (e.g., 1700, 1800, 1900, 2100) are NOT leap years. With the help of Jesuit astronomer Christopher Clavius (1537-1612) (using earlier proposals of Pitatus and Lilius), this invention (303 years with 365 days and 97 years with 366 days) is what makes the Gregorian calendar we use today have vernal equinoxes slippage of less than one hour in every 300 years (until circa 4000 AD) by achieving a mean year of
The need for this has been known since the Egyptian calendar, which defined one year with 365.25 mean days consisting of 12 months with a leap year every 4th year — (365*3 + 366)/4. The clever part about the Gregorian calendar is that leap years can be calculated by a year that is divisible by 4. This math was defined by a Scythian monk named Dionysius Exiguus under Pope Gregory XIII in 525 AD. Thus the name "Gregorian calendar". To be more accurate, the Greek (and now Russian) Orthodox Church early this century made a decision to add one leap-day in 2800 A.D (perhaps a divergance from the Roman Catholic Gregorian Calendar). Instead of this, Cassidy proposes the 33 year "Anni Domini" cycle of leap years first proposed by Pope Gregory's Oriental commissioner, the Syrian patriarch Na'amat allah (who in turn cited Omar Khayyam and other Arabic and Persian solar observations). It is calculated with the rule "February will have 29 days whenever the A.D. year-number, reduced modulo 33, is non-zero and divisible by 4." | ![]() ![]() ![]() |
| ![]() ![]() ![]() |
|
.vcs (vCalendar)![]() ![]() Originally developed by Versit Consortium, it has, since December 1996, been adopted by the Internet Mail Consortium. More recently, the Internet Engineering Task Force (IETF) C&S Working Group defined the iCalendar standard to add interactivity such as scheduling of meetings.
vCalendar is supported by
several products, most notably
An appointment in Microsoft Outlook 2000 can be saved as a vCalendar Format (.vcs) file type. Such files will contain PRODID:-//Microsoft Corporation//Outlook 9.0 MIMEDIR//EN vCalendar file icons can be dragged and dropped on the Calendar folder shortcut on the Outlook toolbar.
Those who offer vCal files for download include
| ![]() ![]() ![]() |
A sample .vcs file:
BEGIN:VCALENDAR PRODID:-//The Kennedy Center//NONSGML Web Calendar//EN VERSION:1.0 METHOD:DISPLAY DAYLIGHT:TRUE;-06;20060407T025959;19961027T010000;EST;EDT BEGIN:VEVENT DTSTART:20061226T183000Z DTEND:20061226T203000Z LOCATION:The Kennedy Center DESCRIPTION:An original Kennedy Center production \nMusic and lyrics by ... SUMMARY:Roald Dahl's Willy Wonka PRIORITY:3 CLASS:PUBLIC BEGIN:VALARM TRIGGER:PT60M ACTION:DISPLAY DESCRIPTION:Reminder END:VALARM END:VEVENT END:VCALENDAR
Related Topics:
![]()
| Your first name: Your family name: Your location (city, country): Your Email address: |
Top of Page ![]() Thank you! |