How to get the time with time Zone Z in js

how to get this 2018-03-29T06:08:57.008Z time in js

when debugging with the backend, the time type accepted by the backend is in date, format, but I used a lot of methods in js and did not implement it

Feb.28,2021

new Date ('2018-03-29T06Partition 08Rod 57.008Z'). GetTime (); / / converted to timestamp

it is recommended to use timestamps for front-and back-end communication and database storage, which should be specified in milliseconds or seconds.


js native Date objects do not seem to be able to generate this format. The date in this format is consistent with the data parsed by the backend after the time is uploaded in the excel table. It is Greenwich mean time, and there is a time difference of 8 hours with ours. When doing the calculation, you'd better use a method with UTC, such as date.getUTCHours () for conversion. Maybe I am wrong. If any boss knows, please let me know

.
Menu