EllisLab text mark
Advanced Search
     
Date Helper
Posted: 18 November 2012 11:05 AM   [ Ignore ]
Joined: 2012-10-02
16 posts

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

 
Posted: 18 November 2012 03:20 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

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

See getdate

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 18 November 2012 04:06 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2012-01-25
71 posts

Try something like this:

$timezone 'UP45';
     
$daylight_saving TRUE;
     
$unixdate human_to_unix($row->d_date);
     
$unixdoj=gmt_to_local($unixdate$timezone$daylight_saving);
     
$dojmdate('%d-%m-%Y %h:%i %A'$unixdoj); 
 
Posted: 18 November 2012 05:59 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-19
3801 posts

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

 Signature