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.
Not a member yet? Click here to register.
Forgot Password?

New function format_date not showing right time

Asked Modified Viewed 1,592 times
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
  • Answered 1 question
asked
Senior Member

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
0 replies

9 posts

D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
  • Answered 1 question
answered
Senior Member

In maincore

Replace existing function
0 replies
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
answered
Senior Member

I have some version 8 sites online...where would I add/change this code douwe_yntema
0 replies
F
Falk
F
Falk 148
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 12 questions
answered
Super Admin

0 replies
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
  • Answered 1 question
answered
Senior Member

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));
   }
}
0 replies
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
  • Answered 1 question
answered
Senior Member

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
0 replies
E
Ernst74
E
  • Junior Member, joined since
  • Contributed 32 posts on the community forums.
  • Started 14 threads in the forums
answered
Junior Member

$lcmerid = explode('|', $locale['meridiem']);

can not be right. In Germany we have no am,pm or AM and PM for time.
0 replies
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
  • Answered 1 question
answered
Senior Member

As said, PF8 not 9.....
0 replies
K
karrak
K
karrak 32
Van mi sosem változik..smile
  • Senior Member, joined since
  • Contributed 310 posts on the community forums.
  • Started 94 threads in the forums
  • Answered 1 question
answered
Senior Member

0 replies
K
karrak
K
karrak 32
Van mi sosem változik..smile
  • Senior Member, joined since
  • Contributed 310 posts on the community forums.
  • Started 94 threads in the forums
  • Answered 1 question
answered
Senior Member

displays the time well, but not the text (month or days)
0 replies

Labels

Statistics

  • Views 0 views
  • Posts 9 posts
  • Votes 0 votes
  • Topic users 5 members

5 participants

F
F
Falk 148
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your Topics and Content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Provide with an URL to live example if one exists
• Please read the How to Report an Error post
• Please read and comply with the Code of Conduct

(¯·._.·(¯°·._.·°º*[ Project Manager ]*º°·._.·°¯)·._.·¯)
  • Super Admin, joined since
  • Contributed 6,201 posts on the community forums.
  • Started 639 threads in the forums
  • Answered 12 questions
A
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
K
K
karrak 32
Van mi sosem változik..smile
  • Senior Member, joined since
  • Contributed 310 posts on the community forums.
  • Started 94 threads in the forums
  • Answered 1 question
D
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Started this discussions
  • Answered 1 question
E
E
  • Junior Member, joined since
  • Contributed 32 posts on the community forums.
  • Started 14 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet