Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Hello everyone,
- I‘m currently having an understanding issue with time stamp formatting, and was hoping one of you could help me.
- The situation is as follows: I’m receiving a json file with a start and an end time in the ‘yyyy-mm-ddThh:mm:ss.SSSZ
- */
- const date = "2022-01-14T04:45:33.333-0400"
- let d = new Date()
- log(d)
- let dF = new DateFormatter()
- dF.dateFormat = 'yyyy-MM-dd hh:mm:ss.SSSZ'
- let dStr = dF.string(d)
- log(dF.date(dStr))
- let data = [{"startTime":"2022-01-14T04:45:33.333-0500","endTime":"2022-01-14T14:45:33.333-0400"}]
- let list = new ListWidget()
- //const startTime = new Date();
- let startTime = data[0].startTime
- startTime = startTime.replace("T", ' ')
- log(startTime)
- startTime = dF.date(startTime)
- const line1 = list.addDate(startTime)
- line1.applyTimeStyle()
- Script.setWidget(list)
- Script.complete()
- list.presentMedium()
Advertisement
Add Comment
Please, Sign In to add comment