The complete format looks like this:
YYYY-MM-DDThh:mm:ss.sTZD
Example:
1997-07-16T19:20:30.45+01:00
www.w3.org/TR/NOTE-datetime
We want to extract everything before the letter "T" ("Time") there, the date pattern. And make the month as strings, e.g. March, May, July, and so forth. Plus, re-format the structure.
This is in JavaScript
. For other programming languages, there are built-in features to do it, perhaps.
Like in Python, whoa dude.
First, split the string
Let's take the 1997-07-16T19:20:30.45+01:00
as an example input string.
Second, get the first array element and split it again
Third, define month names, day, month, and year variables
Fourth, convert the month number into string
The last, let's combine them all into one function block
Usage
This is only for the date
If your thingy there needs to show every single of them, then build another methods/functions to process the time (hour:minute:second.millisecond am/pm) and the time zone (TZD).
For example
See the Pen DateTime ISO-8601 Extractor by Monkey Raptor (@monkeyraptor) on CodePen.
Related
A tool to find out the weekday name of a particular date, on Port Raptor
No comments
Post a Comment