I’m not familiar with that plugin, but you can set your local time with this code:
$differencetolocaltime=2;
$new_U=date("U")+$differencetolocaltime*3600;
print date('F j, Y') . " " . date('g:i a', $new_U) . " EDT ";
Just look for the date(); php code. Most likely, it’s formatted something like date('g:1 a');, or if it’s using WordPress stuff, you’re looking for the_time(); But the above code shows Eastern time based on where the server is located (*3600 = +4 hours)
Hope that gets you started.
Thread Starter
Jardry
(@jardry)
This is the date function within the plugin:
function todays_date() {
$date_array = localtime(time()) ;
$month = $date_array[4]+1;
if ($month<10) {
$month = "0".$month;
}
$day = $date_array[3];
if ($day<10) {
$day = "0".$day;
}
$year = $date_array[5] + 1900 ;
$cdate = "$year-$month-$day";
return $cdate;
}
Where and how do I change the above code so as to offset the day to use my localtime rather than the server’s time.
Regards
Jardry
Thread Starter
Jardry
(@jardry)
I think I have this worked out!
I added into the $date_array “+(60*60*14.5)”:
$date_array = localtime(time()+(60*60*14.5)) ;
The server is in Dallas USA which is in timezone GMT -5, I’m in Australia in timezone GMT +9.5, which means I need to add 14.5 * 60 minutes * 60 seconds to get my local time.
When I uploaded the edited file, it indicated no views to date, then I visited a couple of posts and the counts commenced. I’ll check it throughout the day and hopefully when I check tomorrow morning the counts will be lower than what they were late tonight!