News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Timezone problem

Started by Sir Osis of Liver, May 27, 2021, 05:30:16 PM

Previous topic - Next topic

Sir Osis of Liver

Having a problem with timezone.  Trying to display last_login in date format in ManageMembers.php rather than number of days.  This works -



'data' => array(
'function' => function($rowData) use ($txt)
{
// Calculate number of days since last online.
if (empty($rowData['last_login']))
$difference = $txt['never'];
else
{
$difference = date('d M Y H:i' , $rowData['last_login']);



But timezone for last_login is incorrect.  If I do this -



'data' => array(
'function' => function($rowData) use ($txt)
{
// Calculate number of days since last online.
if (empty($rowData['last_login']))
$difference = $txt['never'];
else
{
date_default_timezone_set('America/New_York');
$difference = date('d M Y H:i' , $rowData['last_login']);



Timezone for last_login is correct, but time displayed in userinfo only on Admin -> Members page is incorrect.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Advertisement: