View Full Version : time functions in php
01-09-2008, 09:48 AM
i'am new one to php.i have one doubt in time functions.my requirement is, i have to add 10mins with the current time.i dont have idea about this.can anyone help me.
the strtotime function is quite intelligent in parsing relative times:
echo strtotime('+10 minutes'); //will give the timestamp
echo date('Y-m-d H:i:s',strtotime('+10 minutes')); //will give a more readable format
01-09-2008, 01:07 PM
i tried your code,it works :-)
but your code display the current time in Unix timestamp format.how i convert that unix timestamp into my local time?
01-09-2008, 02:17 PM
The second line of the posted code above shows you.
01-09-2008, 03:19 PM
Wouldn't this be much more consistent/obvious/efficient?
$timePlusTenMinutes = time() + 60 * 10;
echo date('r', $timePlusTenMinutes);
01-09-2008, 10:56 PM
I think both are good :)
01-10-2008, 06:20 AM
i tried ur code.its really good.thanks:-)
01-10-2008, 06:51 AM
01-10-2008, 07:30 AM
how to convert GMT(Greenwich Mean Time) to IST(Indian Standard Time) format?
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.