Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.
Forgot Password?
Navigation

New function format_date not showing right time

Last updated on 3 years ago
D
douwe_yntemaSenior Member
Posted 3 years ago
In maincore

Replace existing function
A
afosterSenior Member
Posted 3 years ago
I have some version 8 sites online...where would I add/change this code douwe_yntema
F
FalkSuper Admin
Posted 3 years ago
D
douwe_yntemaSenior Member
Posted 3 years ago
Below is changed function showdate, fixes a bug with daylight saving time.

Maybe it can be imported in next update (if)

// Format the date & time accordingly
function showdate($format, $val) {
   global $settings, $userdata;

   if (isset($userdata['user_offset'])) {
      $offset = $userdata['user_offset']+$settings['serveroffset'];
   } else {
      $offset = $settings['timeoffset']+$settings['serveroffset'];
   }
 // Correction for Daylight saving Time
 $dls = 0;
 if (date('I', $val+($offset*3600)) == 1){
 $dls = 3600;
 }

   if ($format == "shortdate" || $format == "longdate" || $format == "forumdate" || $format == "newsdate") {
      return format_date($settings[$format], $val+$dls+($offset*3600));
   } else {
      return format_date($format, $val+$dls+($offset*3600));
   }
}
D
douwe_yntemaSenior Member
Posted 3 years ago
It can be solved using showdate and set the correct server offset compensation. But fact is PF does not work with the time zone settings anymore
E
Ernst74Junior Member
Posted 3 years ago
$lcmerid = explode('|', $locale['meridiem']);

can not be right. In Germany we have no am,pm or AM and PM for time.
D
douwe_yntemaSenior Member
Posted 3 years ago
As said, PF8 not 9.....
K
karrakSenior Member
Posted 3 years ago
K
karrakSenior Member
Posted 3 years ago
displays the time well, but not the text (month or days)
D
douwe_yntemaSenior Member
Posted 3 years ago
PF 8 comes with a new function format_date for replacement strftime function, which is deprecated in PHP > 8.1

When I call strftime on my server, time is correct
When I call format_date, time is one hour difference (one houre before)
Timezone is GMT+1
Seems the new function does not work with the time zone.
I tested on different sites
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
You cannot set up a bounty in this discussion thread.
Moderator: Support Team
Users who participated in discussion: Falk, afoster, karrak, douwe_yntema, Ernst74