In my settings i have set the time to be +6 hours of the sever time so it becomes my local time, but when i view my site its still the sever time and not the updated time. what do i do?
-----------------------
If only life was simple......
-----------------------
If only life was simple......
the time shown on the front page is not associated with the manager time settings, it is controlled independently by the snippet
DateTime.
to adjust the time open the DateTime snippet in the manager and find this line:
if(!isset($timestamp)) {
$timestamp=time();
}
add +21600 and it should look like this:
if(!isset($timestamp)) {
$timestamp=time()+21600;
}
you can also access the manager setting using [(server_offset_time)] tag or $modx->config[’server_offset_time’], so you could use that in the snippet when fixin it..
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Indeed. Here is such a fixed snippet.
/**
* DateTime
* Makes a date and time... thingy. Now even thingier.
* Original author unknown.
* 1.01 amended 08Aug06 by Paul Gregory, inspired by doze & breezer.
*/
$format= (!isset($format)) ? "%d-%m-%Y %H:%M:%S" : "$format";
if(!isset($timestamp)) {
$timestamp=time();
}
return strftime($format, $timestamp+$modx->config['server_offset_time']);
I’ll add it to the Repo and I’ll see if I can get that in 0.9.5.
Does anyone know who wrote this snippet? I know it’s like the easiest snippet in teh world, but still.
Oh, and you can now pass a different timestamp format through.
thanks PaulGregory, worked a treat!
-----------------------
If only life was simple......
The DateTime snippet was written by Alex Butter and first appeared in phase06_rc1 back in August 2004