I've got a date format which looks like this: 2017-02-18T09:00:00+06:00.
This is the format I'm trying to parse it with: d3.utcParse("%Y-%m-%dT%H:%M:%S+%Z");, but it returns null.
Any ideas? Thanks!
Instead of
d3.utcParse("%Y-%m-%dT%H:%M:%S+%Z");//+ is not needed
It should have been
d3.utcParse("%Y-%m-%dT%H:%M:%S%Z")
working code here
Your parsing specifier is not correct. The + in the timezone +06:00 is actually part of the timezone and must not be included in the specifier string.
var parser = d3.utcParse("%Y-%m-%dT%H:%M:%S%Z");
console.log(parser("2017-02-18T09:00:00+06:00"));
<script src="https://d3js.org/d3.v4.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With