Jump to content

Data Calculation's


Recommended Posts

Ok, I am getting the date like this

$date = strtotime(date());

ok, there you have it, a Unix time stamp of the time, date, and everything else.

From here, is this the best way to do calculations.

Like if I wanted to tell when 48 hours had passed from this date, how do I go about doing that.

I know for example if you wanted to add a day, you check on how many "number's" here are in a day and put + that number onto the strength.

Can someone tell me some stuff about this, so I am more familiar with dates, before I start all of these calculations.

Link to comment
https://forums.phpfreaks.com/topic/49810-data-calculations/
Share on other sites

Hi

 

you may want to look at the funtion mktime(): http://uk.php.net/mktime

 

Using this u can do things like

 

mktime(date("h"),date("i"),date("s")+10)

 

to add 10 seconds to the current time etc,or

 

$date = time() + mktime(0,0,0,0,2,0);

 

will return now + 2 days.

 

Hope that helps,

cheers

tdw

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/49810-data-calculations/#findComment-244318
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.