Welcome Guest, Not a member yet? Register   Sign In
Date Helper
#1

[eluser]surf66[/eluser]
Hi,

This is just a quick query on the Date Helper as I am struggling.

I have a timestamp in a db stored as: 2012-11-11 23:14:54

I simply want it to display something like: 11th Nov at 11:14pm

Should I be using the unix_to_human() method for this?

Thanks,
surf66
#2

[eluser]InsiteFX[/eluser]
That will not help, the way you want the date displayed will need a new function/method.

See getdate
#3

[eluser]Shiju S S[/eluser]
Try something like this:
Code:
$timezone = 'UP45';
     $daylight_saving = TRUE;
     $unixdate = human_to_unix($row->d_date);
     $unixdoj=gmt_to_local($unixdate, $timezone, $daylight_saving);
     $doj= mdate('%d-%m-%Y %h:%i %A', $unixdoj);
#4

[eluser]CroNiX[/eluser]
You can also format it directly in the query itself and not waste extra time processing your results with PHP.
http://davidwalsh.name/format-date-mysql-date_format




Theme © iAndrew 2016 - Forum software by © MyBB