CMS Displays, International Date/Time, Not Showing Correctly

There are a couple of places that the date and time do not show up correctly after turning on International date/time. Most places show the date and time correctly. The one that is driving me crazy is the Displays screen in the CMS. Here is a screenshot.

I should of noted that I am using CMS 1.7.3

I believe that should get picked up by

I thought I had remembered seeing that somewhere.

No easy workaround for now?

For now, In display.class.php.php,I replaced line 463:

    $row['lastaccessed'] = DateManager::getLocalDate($row['lastaccessed']);

With:

    $row['lastaccessed'] = DateTime::createFromFormat( 'U', $row[lastaccessed]);
    $new_timezone = new DateTimeZone(date_default_timezone_get());
    $row[lastaccessed] = $row[lastaccessed]->setTimezone($new_timezone);
    $row[lastaccessed] = $row[lastaccessed]->format('Y-m-d H:i:s');

It returns the local time to the server for the time stamp

Edit: Not sure if this works on anything other than PHP 5.2+

You just need to change your default date format in the CMS settings so that it has a correct mask for ISO codes.

Dan,

Thank you. I undid my changes and tried to change the date to the format suggestion in the Post Setup Guide. It says to use “YYYY-MM-DD HH:mm:ss”. However using “DD” gives me the day number of the year. I changed the “DD” to “d” and now the time is good. :smiley: Oh yeah.

Thanks Colin. I’ve amended the guide.

Haha, that was the one piece of the guide based on my input! :flushed:

Your welcome. BTW, I love the guide. Really good stuff in there that solves a lot of configuration problems.

1 Like

Alex,

You may also want to change in the guide:

By default Xibo CMS shows dates in YYYY-MM-DD HH:i format (eg 2015-03-29 10:00:00)

As it would really read (I think):

By default Xibo CMS shows dates in YYYY-MM-DD HH:i format (eg 2015-03-88 10:00:00)

Just a thought.

If you have internationalised dates turned off then MM-DD will give you correct day of the month (as is the default).

Are you saying the date string we’re suggesting if you have internationalised dates turned on still gives the incorrect output?

Sorry right I see what you mean.

The default is Y-m-d H:i

By YYYY-MM-DD I meant that as a normal person reading that they’d understand it was 2015-02-28 but I can change it to be the actual default date format string (although I’m not sure it’s as readable)

Can you confirm that the suggested change to YYYY-MM-dd HH:mm:ss is what you’re now using, and is correct?

Sorry Alex, I should have been more clear.

It is just the “(eg 2015-03-29 10:00:00)” part that would be incorrect. “DD” would give you the number of the day of the year. Not the number of the day of the month. So "YYYY-MM-DD HH:i " would really output “(eg 2015-03-88 10:00:00)” and not “(eg 2015-03-29 10:00:00)”

The other parts are correct.

As to

Can you confirm that the suggested change to YYYY-MM-dd HH:mm:ss is what you’re now using, and is correct?

I am currently using Internationalised dates and the format “YYYY-MM-d HH:mm:ss” which gives me the format I would expect in 24 hour time.