djones Posted October 10, 2006 Share Posted October 10, 2006 mktime is confusing for me. Can someone please help me to convert 09:00:00 (HH:MM:SS) add 30 min to the time, 09:30:00, and convert to unix time 093000? Quote Link to comment https://forums.phpfreaks.com/topic/23491-mktime-help/ Share on other sites More sharing options...
djones Posted October 10, 2006 Author Share Posted October 10, 2006 Can someone help please? Quote Link to comment https://forums.phpfreaks.com/topic/23491-mktime-help/#findComment-106760 Share on other sites More sharing options...
Daniel0 Posted October 10, 2006 Share Posted October 10, 2006 If you just need to add 30 minutes to the time, then do this:[code]<?php$time = "09:00:00";echo date('H:i:s',strtotime("+30 minutes")-time()+strtotime($time));?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23491-mktime-help/#findComment-106787 Share on other sites More sharing options...
djones Posted October 10, 2006 Author Share Posted October 10, 2006 That worked. I would have never figured out the strtotime(). Thanks Quote Link to comment https://forums.phpfreaks.com/topic/23491-mktime-help/#findComment-106817 Share on other sites More sharing options...
obsidian Posted October 10, 2006 Share Posted October 10, 2006 shorten it up a bit:[code]<?php$time = "09:00:00";echo date('H:i:s', strtotime("$time +30 minutes"));?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23491-mktime-help/#findComment-106827 Share on other sites More sharing options...
Daniel0 Posted October 10, 2006 Share Posted October 10, 2006 [quote author=obsidian link=topic=111019.msg449839#msg449839 date=1160489241]shorten it up a bit:[code]<?php$time = "09:00:00";echo date('H:i:s', strtotime("$time +30 minutes"));?>[/code][/quote]Ahh, nice. I was looking in the manual, but I couldn't see if it was possible to give a time and a +30 minutes thing... Quote Link to comment https://forums.phpfreaks.com/topic/23491-mktime-help/#findComment-106832 Share on other sites More sharing options...
obsidian Posted October 10, 2006 Share Posted October 10, 2006 [quote author=Daniel0 link=topic=111019.msg449844#msg449844 date=1160489597]Ahh, nice. I was looking in the manual, but I couldn't see if it was possible to give a time and a +30 minutes thing...[/quote]yes, i believe you can also do it like this:[code]<?phpecho date('H:i:s', strtotime($time, "+30 minutes"));?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23491-mktime-help/#findComment-106835 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.