UnrEALMe Posted May 16, 2007 Share Posted May 16, 2007 i need help !! how can i add GMT +80:00 into this code which will generate malaysia date... $date = mktime(0, 0, 0, date("m"), date("d"), date("y")); if not mistaken the time generated is GMT +00:00...anyone ?? Quote Link to comment https://forums.phpfreaks.com/topic/51740-how-to-add-gtm-8000/ Share on other sites More sharing options...
hitman6003 Posted May 16, 2007 Share Posted May 16, 2007 I don't think Malaysia is 80 hours ahead of GMT.... Anyway, I haven't tested it, but I think you can do something like.. $date = mktime(80, 0, 0, date("m"), date("d"), date("y")); Quote Link to comment https://forums.phpfreaks.com/topic/51740-how-to-add-gtm-8000/#findComment-254918 Share on other sites More sharing options...
UnrEALMe Posted May 17, 2007 Author Share Posted May 17, 2007 oppps... is GMT +08.00..hehe btw i tried adi .. need add around 30 only seem to be correct... haven fully tested... Quote Link to comment https://forums.phpfreaks.com/topic/51740-how-to-add-gtm-8000/#findComment-255111 Share on other sites More sharing options...
UnrEALMe Posted May 17, 2007 Author Share Posted May 17, 2007 i tested many times and it seem not to be working?? any1?? i need to generate a malaysia date only.. tq.. Quote Link to comment https://forums.phpfreaks.com/topic/51740-how-to-add-gtm-8000/#findComment-255295 Share on other sites More sharing options...
Lumio Posted May 17, 2007 Share Posted May 17, 2007 <?php $time = time(); //get timestamp $date = date('H:i:s', $time); //get time with timestamp $newtime = strtotime($date.' +0800', $time); //get new timestamp with 8h difference echo date('Y-m-d H:i:s', $time).' - '.date('Y-m-d H:i:s', $newtime); ?> Quote Link to comment https://forums.phpfreaks.com/topic/51740-how-to-add-gtm-8000/#findComment-255342 Share on other sites More sharing options...
UnrEALMe Posted May 17, 2007 Author Share Posted May 17, 2007 this is the result i got from your code lol Quote Link to comment https://forums.phpfreaks.com/topic/51740-how-to-add-gtm-8000/#findComment-255566 Share on other sites More sharing options...
Lumio Posted May 17, 2007 Share Posted May 17, 2007 what is so funny? What do you get? Quote Link to comment https://forums.phpfreaks.com/topic/51740-how-to-add-gtm-8000/#findComment-255573 Share on other sites More sharing options...
UnrEALMe Posted May 17, 2007 Author Share Posted May 17, 2007 ei.. i din post it ?? hmm this is it ... 2007-05-17 16:53:52 - 2007-05-17 08:53:52 the result i get... Quote Link to comment https://forums.phpfreaks.com/topic/51740-how-to-add-gtm-8000/#findComment-255797 Share on other sites More sharing options...
Lumio Posted May 17, 2007 Share Posted May 17, 2007 what's wrong with it? 2007-05-17 16:53:52 2007-05-17 08:53:52 Maybe you don't see the result: First you see the normal date and then you see the changed time change echo date('Y-m-d H:i:s', $time).' - '.date('Y-m-d H:i:s', $newtime); to echo date('Y-m-d H:i:s', $newtime); and it only shows you the new time with +0800 Quote Link to comment https://forums.phpfreaks.com/topic/51740-how-to-add-gtm-8000/#findComment-255802 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.