For example the date “2010-01-28 12:47 PM” is stored as “1264740458”. If I wanted to take a date and format it that way with PHP by hand how would I do it?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
January 24, 2010 6:08pm
Subscribe [3]#1 / Jan 24, 2010 6:08pm
For example the date “2010-01-28 12:47 PM” is stored as “1264740458”. If I wanted to take a date and format it that way with PHP by hand how would I do it?
#2 / Jan 24, 2010 7:30pm
You can apply date format before handed to PHP.
#3 / Jan 24, 2010 8:12pm
i need the reverse, i.e. how is the number that EE stores created?
#4 / Jan 24, 2010 10:08pm
That’s a unix timestamp (time since epoch)
To get that value of the current time in php you can just use
<?php
// set your timezone if it isn't already set
date_default_timezone_set('EST');
// display unix timestamp
echo date('U');
?>#5 / Jan 24, 2010 10:09pm
That’s a unix timestamp (time since epoch)
To get that value of the current time in php you can just use
<?php // set your timezone if it isn't already set date_default_timezone_set('EST'); // display unix timestamp echo date('U'); ?>
thanks that’s exactly what I needed.
#6 / Jan 24, 2010 10:10pm
Awesome. Glad to help Ryan 😊