Skip to content

Instantly share code, notes, and snippets.

@vishichoudhary
Created September 29, 2019 14:37
Show Gist options
  • Save vishichoudhary/e77783e46993fcdcbad87d33acf6524c to your computer and use it in GitHub Desktop.
Save vishichoudhary/e77783e46993fcdcbad87d33acf6524c to your computer and use it in GitHub Desktop.
10 minute of hard work
--------------- + ------------ + ------------
Type | Placeholder | Example values
--------------- + ------------ + ------------
Year | 2006 | 1609
Year | 06 | 09
Month | 01 | 09
Month | 1 | 9
Month | Jan | Sep
Month | January | September
Day | 02 | 12
Day | 2 | 12
Week day | Mon | Sat
Week day | Monday | Saturday
Hours | 03 | 07
Hours | 3 | 7
Hours | 15 | 19
Minutes | 04 | 02
Minutes | 4 | 2
Seconds | 05 | 35
Seconds | 5 | 35
AM or PM | PM | PM
Miliseconds | .000 | .123
Microseconds | .000000 | .123456
Nanoseconds | .000000000 | .123456789
Timezone offset | -0700 | +0300
Timezone offset | -07:00 | +03:00
Timezone offset | Z0700 | +0300
Timezone offset | Z07:00 | +03:00
Timezone | MST | PDT
lets say you string is like yy-mm-dd hr:mi:se
your parsed string will be like "2006-01-02 15:04:05"
2006 mean year format
01 mean month format in numbers with 2 character
02 same for day
15 mean hours in 24 format
01 mean minute in number format with 2 character
now you got it vishi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment