Jump to content

Archived

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

paulspoon

Date Calculation

Recommended Posts

I've got the following :

[code]$grvdate = date("Y-m-d");[/code]

How can I subtract three days from todays date and use it in a further query ?

Regards

Share this post


Link to post
Share on other sites
check the date() function http://www.phpfreaks.com/phpmanual/page/function.date.html

Share this post


Link to post
Share on other sites
[code=php:0]date("Y-m-d",mktime(0,0,0,date("m"),date("d")-3,date("Y")));[/code]

[b]EDIT:[/b] Beaten to it!

Share this post


Link to post
Share on other sites
You can use:
[code]<?php $threedaysago = date("Y-m-d",strtotime("-3 days")); ?>[/code]

Ken

Share this post


Link to post
Share on other sites

×

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.