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 ??? Quote Link to comment 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 Quote Link to comment 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] Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
almightyegg Posted October 26, 2006 Author Share Posted October 26, 2006 Yay!! thank you both :) Quote Link to comment 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?? Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
almightyegg Posted October 26, 2006 Author Share Posted October 26, 2006 alpines way worked fine :) Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.