My dataset includes UNIX timestamps, such as "1509392160". I can't seem to parse those using d3.timeParse("%s")
, which returns null.
Checking the reverse process with d3.timeFormat
fails me as well. The official example and all other format strings work:
var formatTime = d3.timeFormat("%B %d, %Y");
formatTime(new Date); // -> "June 30, 2015"
However, formatting to UNIX (milli)seconds just returns "s" or "Q" for "%s" and "%Q":
var formatTime = d3.timeFormat("%s");
formatTime(new Date); // -> "s"
Using D3 v4.11.0 btw.
What am I missing?
Copyright Notice:Content Author:「gl03」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/47043555/d3v4-d3-timeparse-fails-with-unix-epoch-seconds-s