Unable to complete the project in Apis in node JS

Tell us what’s happening:
Describe your issue in detail here.

o
Your project link(s)

solution: https://replit.com/@saichaitanya7/boilerplate-project-timestamp-7

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Challenge: Timestamp Microservice

Link to the challenge:

  1. The UNIX timestamp that is used will be a string, but has to be a number.

/api/1451001600000

new Date('1451001600000').getTime() > 0
// false
  1. The date format isn’t correct (note the order of day and month and the time).
let date_string = new Date(1451001600000).toDateString()
let result = date_string.split(" ")[0] + "," + date_string.substring(3) + " " + new Date().toTimeString(1451001600000).split("+")[0]
console.log("result", result)
// result Fri, Dec 25 2015 21:17:55 GMT

A request to /api/1451001600000 should return { unix: 1451001600000, utc: "Fri, 25 Dec 2015 00:00:00 GMT" }

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.