Quick question on date formatting

Started by 4X4UK, June 14, 2010, 10:02:04 AM

Previous topic - Next topic

4X4UK

I had a page using ssi with the following which correctly returned the date registered when I was using smf 1.19, just upgraded to smf 2.0 RC3 and dates are now showing the year as 1970.  All dates show correctly in the forum


function ssi_membership($output_method = 'echo')
{
global $context, $txt, $scripturl, $options, $user_settings;

if ($output_method == 'echo')
{
if ($context['user']['is_guest'])
echo $txt['welcome_guest'];
else

echo 'Membership No:   <b>', $context['user']['id'],
'</b><br>Full Name: <b>',$options['CP1'],
'</b><br>Forum Screenname: <b>', $context['user']['name'],
'</b><br>','Contact e-mail: <b>',$context['user']['email'],
'</b><br>Join Date: <b>',timeformat($user_settings['dateRegistered']), '</b><br>';

}
// Don't echo... then do what?!
else
return $context['user'];
}

any pointers on what I have wrong with the date formatting for the  usersettings date registered would be greatly appreciated

many thanks
Ian

Tyrsson

Give this one a shot.

$context['member']['registered']
PM at your own risk, some I answer, if they are interesting, some I ignore.

4X4UK


4X4UK

#3
Tried that and dont get any value returned will have another look, the only way I can get it to display is with the following


timeformat($context['member']['registered'])

and as soon as I do that I'm back to years showing as 1970

4X4UK

note to admins this topic can be marked as solved, found the problem

changed
'</b><br>Join Date: <b>',timeformat($user_settings['dateRegistered']), '</b><br>';
to
'</b><br>Join Date: <b>',timeformat($user_settings['date_registered']), '</b><br>';

and all works fine looks like I missed the change in the field names to all lowercase in smf2 compared to smf 1

Tyrsson

Yep that would do it.

Ah, I missed the part about you using SSI.. DOH!!
PM at your own risk, some I answer, if they are interesting, some I ignore.

Advertisement: