tourer Posted December 3, 2009 Share Posted December 3, 2009 Hey friends. I was looking for a Code which can convert my current server time into minutes: as in if its 12.00 am, it should show 0 minutes, then for 01.00 am it shows 60, till upto 1439 minutes for 11.59 pm. Please anyone can help me. Actually my Mysql DB stores time in minutes format nd somewhere i need to compare the current server time with the time stored in the Database. My Humble try is added below: <?php date_default_timezone_set('Asia/Kolkata'); $T_time = date("H:i:s"); ?> Link to comment https://forums.phpfreaks.com/topic/183834-current-server-time/ Share on other sites More sharing options...
Mchl Posted December 3, 2009 Share Posted December 3, 2009 date('H') * 60 + date('i') BTW: You should use DATE, DATETIME, TIME or TIMESTAMP datatype to store time in MySQL. Makes all sort of things much easier. Link to comment https://forums.phpfreaks.com/topic/183834-current-server-time/#findComment-970327 Share on other sites More sharing options...
tourer Posted December 3, 2009 Author Share Posted December 3, 2009 Thank you very much for such a speedy reply. so i made it like below: <?php date_default_timezone_set('Asia/Kolkata'); $date = date('H') * 60 + date('i'); echo "$date"; ?> Thanks Again. Link to comment https://forums.phpfreaks.com/topic/183834-current-server-time/#findComment-970331 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.