Skip to content

Latest commit

 

History

History
394 lines (315 loc) · 8.39 KB

File metadata and controls

394 lines (315 loc) · 8.39 KB

Comprehensive Date, Time, and Timestamp Formats Reference

ISO 8601 Formats

Basic ISO Formats

  • 2024-03-15 (Date only)
  • 20240315 (Basic format without separators)
  • 2024-W11 (Week date)
  • 2024-W11-5 (Week date with day)
  • 2024W115 (Basic week date)
  • 2024-074 (Ordinal date - day 74 of year)
  • 2024074 (Basic ordinal date)

ISO DateTime Formats

  • 2024-03-15T14:30:45 (Date and time)
  • 2024-03-15T14:30:45Z (UTC/Zulu time)
  • 2024-03-15T14:30:45+00:00 (With timezone offset)
  • 2024-03-15T14:30:45-05:00 (Negative offset)
  • 2024-03-15T14:30:45.123 (With milliseconds)
  • 2024-03-15T14:30:45.123456 (With microseconds)
  • 2024-03-15T14:30:45.123456789 (With nanoseconds)
  • 2024-03-15T14:30:45,123 (Comma for decimal - European)
  • 20240315T143045 (Basic format)
  • 20240315T143045Z (Basic with UTC)
  • 2024-03-15 14:30:45 (Space instead of T)

RFC Formats

RFC 2822 / RFC 5322 (Email)

  • Fri, 15 Mar 2024 14:30:45 +0000
  • Fri, 15 Mar 2024 14:30:45 GMT
  • Fri, 15 Mar 2024 14:30:45 EST
  • 15 Mar 2024 14:30:45 +0000 (Without day name)

RFC 3339

  • 2024-03-15T14:30:45Z
  • 2024-03-15T14:30:45.123Z
  • 2024-03-15T14:30:45+00:00
  • 2024-03-15t14:30:45z (Lowercase variant)

RFC 850 (Obsolete but still found)

  • Friday, 15-Mar-24 14:30:45 GMT
  • Friday, 15-Mar-2024 14:30:45 GMT

RFC 1123

  • Fri, 15 Mar 2024 14:30:45 GMT
  • Fri, 15 Mar 2024 14:30:45 UTC

American Formats

MM/DD/YYYY Variations

  • 03/15/2024
  • 3/15/2024 (No leading zeros)
  • 03/15/24
  • 3/5/24
  • 03-15-2024 (Hyphens)
  • 03.15.2024 (Dots)
  • 03 15 2024 (Spaces)

Written American Formats

  • March 15, 2024
  • Mar 15, 2024
  • March 15th, 2024
  • Mar. 15, 2024 (Period after abbreviation)
  • March 15 2024 (No comma)
  • 15 March 2024 (Day first variant)
  • 15th March 2024
  • 15th March, 2024

European Formats

DD/MM/YYYY Variations

  • 15/03/2024
  • 15/3/2024 (No leading zeros)
  • 15/03/24
  • 15.03.2024 (Common in Germany, Russia)
  • 15,03,2024 (Comma separator)
  • 15-03-2024 (Hyphens)
  • 15 03 2024 (Spaces)
  • 15·03·2024 (Middle dot)

Written European Formats

  • 15 March 2024
  • 15. March 2024 (With period)
  • 15 mars 2024 (French)
  • 15 marzo 2024 (Spanish/Italian)
  • 15. März 2024 (German)
  • 15 de marzo de 2024 (Spanish with "de")

Asian Formats

Japanese

  • 2024年3月15日
  • 令和6年3月15日 (Japanese era)
  • 2024/03/15
  • 24/03/15
  • H24.03.15 (Heisei era abbreviated)
  • R6.3.15 (Reiwa era abbreviated)

Chinese

  • 2024年3月15日
  • 2024-03-15
  • 2024/3/15
  • 二〇二四年三月十五日 (Traditional characters)

Korean

  • 2024년 3월 15일
  • 2024.03.15
  • 2024-03-15
  • 24.3.15

Time Formats

24-Hour Time

  • 14:30
  • 14:30:45
  • 14:30:45.123
  • 14.30 (Dot separator - some European)
  • 14h30 (French style)
  • 14h30m45s
  • 1430 (Military time)
  • 143045 (Military with seconds)
  • 14:30:45,123 (Comma for decimal)

12-Hour Time

  • 2:30 PM
  • 2:30:45 PM
  • 2:30:45.123 PM
  • 2:30PM (No space)
  • 2:30 pm (Lowercase)
  • 2:30 P.M. (With periods)
  • 2:30p (Abbreviated)
  • 02:30 PM (Leading zero)
  • 2.30 PM (Dot separator)

Time Zones

  • 14:30:45 GMT
  • 14:30:45 UTC
  • 14:30:45 EST
  • 14:30:45 PST
  • 14:30:45 America/New_York
  • 14:30:45 Europe/London
  • 14:30:45 +0530 (India)
  • 14:30:45 +05:30
  • 14:30:45 GMT+5:30
  • 14:30:45 UTC+08:00

Unix/Epoch Timestamps

Seconds

  • 1710510645 (Unix timestamp in seconds)
  • @1710510645 (With @ prefix)

Milliseconds

  • 1710510645123 (13 digits)
  • 1710510645123.456 (With decimal)

Microseconds

  • 1710510645123456 (16 digits)

Nanoseconds

  • 1710510645123456789 (19 digits)

Database/Log Formats

MySQL

  • 2024-03-15 14:30:45
  • 2024-03-15 14:30:45.123456
  • 20240315143045 (Compact)
  • 24-03-15 14:30:45

PostgreSQL

  • 2024-03-15 14:30:45
  • 2024-03-15 14:30:45.123456
  • 2024-03-15 14:30:45+00
  • 2024-03-15 14:30:45.123456+00:00

Oracle

  • 15-MAR-24
  • 15-MAR-2024
  • 15-MAR-24 14.30.45
  • 15-MAR-2024 14:30:45.123456

MongoDB

  • ISODate("2024-03-15T14:30:45.123Z")
  • 2024-03-15T14:30:45.123+0000

Syslog/Log File Formats

Traditional Syslog

  • Mar 15 14:30:45
  • Mar 5 14:30:45 (Double space for single digit)

Common Log Format

  • 15/Mar/2024:14:30:45 +0000
  • [15/Mar/2024:14:30:45 +0000]

Apache/Nginx

  • 15/Mar/2024:14:30:45 +0000
  • 2024/03/15 14:30:45

Windows Event Log

  • 3/15/2024 2:30:45 PM
  • 2024-03-15 14:30:45.123

Programming Language Specific

JavaScript

  • Fri Mar 15 2024 14:30:45 GMT+0000 (UTC)
  • 2024-03-15T14:30:45.123Z

Python

  • 2024-03-15 14:30:45.123456
  • 2024-03-15T14:30:45.123456

Go

  • 2006-01-02T15:04:05Z07:00
  • 2006-01-02 15:04:05
  • Jan 2, 2006 at 3:04pm (MST)

.NET/C#

  • 3/15/2024 2:30:45 PM
  • 15/03/2024 14:30:45
  • 2024-03-15T14:30:45.1234567

Compact/Abbreviated Formats

Short Dates

  • Mar 15
  • 15 Mar
  • 3/15
  • 15/3
  • 03-15
  • Mar-15
  • 15-Mar

Year-Month Only

  • 2024-03
  • 03/2024
  • 2024/03
  • Mar 2024
  • March 2024
  • 2024 March
  • 202403 (Compact)

Quarter Formats

  • Q1 2024
  • 2024 Q1
  • 2024Q1
  • 1Q2024
  • Q1/2024
  • Q1-2024

Relative/Natural Language Formats

Relative Dates

  • today
  • yesterday
  • tomorrow
  • 2 days ago
  • 3 weeks ago
  • last Monday
  • next Friday
  • last month
  • next year

Relative Times

  • now
  • 5 minutes ago
  • in 2 hours
  • 3 hours from now
  • half an hour ago

Special/Regional Variants

Middle Eastern (Right-to-Left)

  • ١٥/٣/٢٠٢٤ (Arabic numerals)
  • ۱۵/۳/۲۰۲۴ (Persian numerals)

Indian Subcontinent

  • 15-03-2024
  • 15/03/2024
  • 15.03.2024
  • 15-Mar-2024

Scandinavian

  • 15.3.2024 (Finland, Norway)
  • 2024-03-15 (Sweden - ISO preference)
  • 15/3-2024 (Denmark)

Latin American

  • 15/03/2024
  • 15-03-2024
  • 15 de marzo de 2024
  • 15/mar/2024

File/Document Naming Conventions

Common File Timestamps

  • 20240315
  • 2024_03_15
  • 2024-03-15
  • 20240315_143045
  • 2024-03-15_14-30-45
  • 20240315T143045
  • 2024.03.15
  • 15032024
  • 03152024

Week/Day Representations

Week Numbers

  • 2024-W11 (ISO week)
  • Week 11, 2024
  • W11/2024
  • 2024W11
  • CW11 2024 (Calendar week)

Day of Year

  • 2024-074 (74th day)
  • 074/2024
  • Day 74, 2024

Duration/Period Formats

ISO 8601 Durations

  • P3Y6M4DT12H30M5S (3 years, 6 months, 4 days, 12 hours, 30 minutes, 5 seconds)
  • PT1H30M (1 hour 30 minutes)
  • P1W (1 week)

Range Formats

  • 2024-03-15 to 2024-03-20
  • 2024-03-15 - 2024-03-20
  • 15/03/2024-20/03/2024
  • Mar 15-20, 2024
  • 2024-03-15/2024-03-20 (ISO)
  • 2024-03-15--2024-03-20 (Double dash)

Edge Cases and Variations

Ambiguous Formats

  • 01/02/03 (Could be Jan 2, 2003 or Feb 1, 2003 or 2001-02-03)
  • 10/11/12 (Highly ambiguous)
  • 5/6/7 (Very ambiguous)

With Ordinal Indicators

  • 1st January 2024
  • 2nd February 2024
  • 3rd March 2024
  • 21st April 2024
  • March 1st, 2024

Spelled Out Numbers

  • March fifteenth, twenty twenty-four
  • The fifteenth of March, 2024
  • Fifteen March two thousand twenty-four

Scientific/Technical

  • 2024.074 (Year with decimal day)
  • 2024-03-15T14:30:45.123456789+00:00 (Full precision)
  • JD 2460384.5 (Julian Date)
  • MJD 60384 (Modified Julian Date)

Timezone Abbreviations (Comprehensive)

  • Standard: EST, CST, MST, PST
  • Daylight: EDT, CDT, MDT, PDT
  • International: BST, CET, CEST, JST, KST, IST, AEST, AEDT
  • Military: A through Z (Alpha through Zulu)

Notes for Implementation

  1. Ambiguity Resolution: Many formats are ambiguous (e.g., 01/02/03). Consider:

    • Context clues
    • Locale settings
    • User preferences
    • Surrounding date formats
  2. Decimal Separators: Both comma (,) and period (.) are used for decimals in different locales

  3. Leading Zeros: Optional in many formats

  4. Case Sensitivity: Consider both upper and lowercase variants

  5. Whitespace: Variable spacing, tabs, and other whitespace characters

  6. Special Characters: Various separators including /, -, ., ,, :, space, middle dot, etc.

  7. Word Boundaries: Consider formats embedded in text

  8. Locale-Specific Month Names: Support multiple languages for month names

  9. Era Support: Japanese eras, Buddhist calendar, Islamic calendar, etc.

  10. Partial Dates: Handle incomplete dates like "March 2024" or just "2024"