DATETIME PATTERNS

Symbols

SymbolMeaningFormatExample
GeratextAD; Anno Domini
yyearyear2020; 20
Dday-of-yearnumber(3)189
Mmonth-of-yearmonth7; 07; Jul; July
dday-of-monthnumber(2)28
Qquarter-of-yearnumber/text3; 03; Q3; 3rd quarter
aam-pm-of-dayam-pmPM
hclock-hour-of-am-pm (1-12)number(2)12
Khour-of-am-pm (0-11)number(2)0
kclock-hour-of-day (1-24)number(2)0
Hhour-of-day (0-23)number(2)0
mminute-of-hournumber(2)30
ssecond-of-minutenumber(2)55
Sfraction-of-secondfraction978
Vtime-zone IDzone-idAmerica/Los_Angeles; Z; -08:30
ztime-zone namezone-namePacific Standard Time; PST
Olocalized zone-offsetoffset-OGMT+8; GMT+08:00; UTC-08:00;
Xzone-offset ‘Z’ for zerooffset-XZ; -08; -0830; -08:30; -083015; -08:30:15;
xzone-offsetoffset-x+0000; -08; -0830; -08:30; -083015; -08:30:15;
Zzone-offsetoffset-Z+0000; -0800; -08:00;
’‘single quoteliteral

Explanation of Some Symbols

Year:

  • yyyy Four-digit year representation, e.g., 2022

Month:

  • M Single-digit month representation, e.g., 3, 12
  • MM Double-digit month representation, e.g., 03, 12

Day of the month:

  • d Single-digit day of the month representation, e.g., 5, 20
  • dd Double-digit day of the month representation, e.g., 05, 20

Hour, 24-hour format:

  • H Single-digit 24-hour format hour representation, e.g., 1, 23
  • HH Double-digit 24-hour format hour representation, e.g., 01, 23

Minute:

  • m Single-digit minute representation, e.g., 4, 59
  • mm Double-digit minute representation, e.g., 04, 59

Second:

  • s Single-digit second representation, e.g., 8, 59
  • ss Double-digit second representation, e.g., 08, 59

Millisecond/Microsecond:

  • S Can have 1-9 digits, from left to right representing milliseconds (3 digits), microseconds (3 digits), nanoseconds (3 digits). Singdata currently supports microsecond precision for timestamps, so nanoseconds will be discarded when parsing time strings, and the nanosecond part will be set to zero when generating time strings. When the number of S digits is less than 9, the precision will be reduced from the right.

Examples:

  • yyyy-MM-dd HH:mm:ss.SSSS: 2022-01-10 10:05:02.1232
  • yyyy/M/d H:m:s.SSSS: 2022/1/10 10:5:2.12
  • yyyy'你好世界yMdH'-MM-dd HH:mm:ss.SSSS: 2022你好世界yMdH-01-10 10:05:02.1232