almightyegg Posted October 26, 2006 Share Posted October 26, 2006 i have $time = date(Y-d-m H:i:s); and it works fine, but i want it to be day-month-year and in GMT time ??? Link to comment https://forums.phpfreaks.com/topic/25191-re-order-date/ Share on other sites More sharing options...
kenrbnsn Posted October 26, 2006 Share Posted October 26, 2006 You can try using the [url=http://www.php.net/gmdate]gmdate()[/url] function.Ken Link to comment https://forums.phpfreaks.com/topic/25191-re-order-date/#findComment-114822 Share on other sites More sharing options...
almightyegg Posted October 26, 2006 Author Share Posted October 26, 2006 thanks that now shows in right order but currently uk is in GMT + 1 hour...how would i put that into:[code=php:0]$time = gmdate("d-m-Y H:i:s");[/code] Link to comment https://forums.phpfreaks.com/topic/25191-re-order-date/#findComment-114825 Share on other sites More sharing options...
alpine Posted October 26, 2006 Share Posted October 26, 2006 [code]<?php$time = date("d-m-Y H:i:s",strtotime('now + 1 hours'));?>[/code] Link to comment https://forums.phpfreaks.com/topic/25191-re-order-date/#findComment-114831 Share on other sites More sharing options...
almightyegg Posted October 26, 2006 Author Share Posted October 26, 2006 Yay!! thank you both :) Link to comment https://forums.phpfreaks.com/topic/25191-re-order-date/#findComment-114838 Share on other sites More sharing options...
almightyegg Posted October 26, 2006 Author Share Posted October 26, 2006 oooh wait...i went to update my database with 00-00-0000 00:00:00 rather than 0000-00-00 00:00:00 and it wouldnt let me change it...so the new time doesnt go in, leaving it at 0000-00-00 00:00:00 in the database...how do i change it?? Link to comment https://forums.phpfreaks.com/topic/25191-re-order-date/#findComment-114849 Share on other sites More sharing options...
alpine Posted October 26, 2006 Share Posted October 26, 2006 Your mysql field type is probably set as "DATETIME" then, you can e.g. change it to VARCHAR or something, more info found here:http://help.scibit.com/Mascon/masconMySQL_Field_Types.html Link to comment https://forums.phpfreaks.com/topic/25191-re-order-date/#findComment-115010 Share on other sites More sharing options...
kenrbnsn Posted October 26, 2006 Share Posted October 26, 2006 Leave how it's stored in the DB alone. Just display it differently.Ken Link to comment https://forums.phpfreaks.com/topic/25191-re-order-date/#findComment-115013 Share on other sites More sharing options...
almightyegg Posted October 26, 2006 Author Share Posted October 26, 2006 alpines way worked fine :) Link to comment https://forums.phpfreaks.com/topic/25191-re-order-date/#findComment-115029 Share on other sites More sharing options...
alpine Posted October 26, 2006 Share Posted October 26, 2006 If you have a lot of existing different scripts (pages) that you display the date in, my way is the easiest one - but, i still agree with kenrbnsn that you for future purposes might want to store all dates in datetime format and modify it when you want to use it. Link to comment https://forums.phpfreaks.com/topic/25191-re-order-date/#findComment-115031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.