I’m having an issue with the displayed ‘last updated time and date’ on my website, it worked fine until now, but now for some reasons the time and date are wrong, even though they are correct in the database.
For instance, I have an item that was last updated at 9:58, it shows that time in the database, but the time shown on the website is 7:58.
Sounds like you’ve got an issue with UTC vs. local time zone issues. Not sure why it happened all of a sudden, but seems like you need to worry about time zones. You can do a search on the Javascript Date() object and all of the fun stuff associated with time zone and UTC issues.
Nothing’s broken. You’ll need to take care of time zones in order to properly display the correct times. A search on the subject should provide you with the info needed.
Have you tried the advice in the article How to Display Today’s Date on Your Site ? Is the time that is in the database the actual time that the site was viewed (locally), or is it the UTC-0 time?
I’d like to take a look at this. Please post the URL of your site. Only authorized Wix personnel can get access to your site in the editor. Of course, the problem might be that it will work in my time zone, but perhaps doesn’t work in yours.
There are two dates elements in 2 repeaters on the home page. Each has its own bit of code to set the date in a custom format :
//modifies the time and date
// Get the orginal date (any format)
let originalDate = itemData._updatedDate;
// Convert the original date into a Date object
let newDate = new Date(originalDate);
// Output updated date format
$w("#text68").text =
'Dernière mise à jour le '
// Get the day
+ newDate.getUTCDate() + ' '
// Get the month
+ monthName[newDate.getUTCMonth()] + ' '
// Get the year
+ newDate.getUTCFullYear() + ' à '
// Get the hour
+ newDate.getUTCHours() + ':'
// Get the minute
+ (newDate.getUTCMinutes()<10?'0':'') + newDate.getUTCMinutes() + ':'
// Get the second
+ (newDate.getUTCSeconds()<10?'0':'') + newDate.getUTCSeconds();