In a DateTimeNumericAxis, can I convert the number from VisibleRange to a formatted string HH:MM:SS?
For example, I’d like to convert this x1 to 12/1/1984, 3:00:00 PM, or 15:00:00.
let x1 = this.parentSurface.annotations.getById("hrv").x1;
// x1 =470761200, seconds since 1970.01.01 00:00:00
Thanks.
- Gang Xu asked 2 years ago
- You must login to post comments
Hello, you simply want to convert the seconds into a formatted date string, right?
If I understood correctly, this is a general question about working with dates…
So here are some hints. You may use a Date object and its methods to construct whatever format you want https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getHours
or alternatively, you may use a third-party library for working with dates, e.g https://date-fns.org/…
- Jim Risen answered 2 years ago
- You must login to post comments
Please login first to submit.