rofl90 Posted April 7, 2008 Share Posted April 7, 2008 I'm guessing this is VERY easy here we go: My code gets the birthday in a timestamp from a database which is $core->profile("birthday", $id) $id being the users id.. heres my code $time_y = time() - $core->profile("birthday", $id); echo date("Y", $time_y); it echo's 1984 Link to comment https://forums.phpfreaks.com/topic/99900-hilariously-easy-timestamp-trouble/ Share on other sites More sharing options...
pocobueno1388 Posted April 7, 2008 Share Posted April 7, 2008 Try this: <?php $time_y = time() - $core->profile("birthday", $id); echo date("Y", strtotime($time_y)); ?> Link to comment https://forums.phpfreaks.com/topic/99900-hilariously-easy-timestamp-trouble/#findComment-510874 Share on other sites More sharing options...
rofl90 Posted April 7, 2008 Author Share Posted April 7, 2008 that gives 1969 Link to comment https://forums.phpfreaks.com/topic/99900-hilariously-easy-timestamp-trouble/#findComment-510875 Share on other sites More sharing options...
pocobueno1388 Posted April 7, 2008 Share Posted April 7, 2008 What do you get if you echo out $time_y? Edit: Also, what is the date supposed to be? Link to comment https://forums.phpfreaks.com/topic/99900-hilariously-easy-timestamp-trouble/#findComment-510878 Share on other sites More sharing options...
rofl90 Posted April 7, 2008 Author Share Posted April 7, 2008 time_y echos 456009783 The timestamp should be about the 26th october 1993, my birthday =) Link to comment https://forums.phpfreaks.com/topic/99900-hilariously-easy-timestamp-trouble/#findComment-510944 Share on other sites More sharing options...
Barand Posted April 7, 2008 Share Posted April 7, 2008 timestamp value for 26 Oct 1993 is 751593600 yours (456009783) is for 1984-06-13 22:23:03 <?php echo date('Y-m-d H:i:s', 751593600); // 1993-10-26 00:00:00 echo date('Y-m-d H:i:s', 456009783); // 1984-06-13 22:23:03 ?> Link to comment https://forums.phpfreaks.com/topic/99900-hilariously-easy-timestamp-trouble/#findComment-511037 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.