I am trying to use the date function to convert unix time that I am trying to convert to a certain format. The function successfully returns the date in the format requested, but the time is wrong. What am I missing here?
const date = (e) => {
const unixTime = 1642698000
const format = {
weekday: 'long',
day: 'numeric',
month: "2-digit",
year: "numeric"
}
return(new Date (unixTime).toLocaleString('en-US', format))
}
Expected output (app.)
Tue Jan 18 2022 17:00:00
The output recieved
Mon Jan 19 1970 19:18:18 GMT-0500 (Eastern Standard Time)
I tried following other exampled but I wasn't able to find any that would resolve this issue. I appreciate your help in advance!