| | #1 |
| Warrior Member Join Date: 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
I am getting current date in php using date function but what I want is date before 15 days. I mean if today is 15th jan then i want it 1st Jan as a date. Thanks |
| |
| | #2 |
| Active Warrior Join Date: 2012 Location: United Kingdom
Posts: 60
Thanks: 0
Thanked 5 Times in 5 Posts
|
You can use strtotime function for that here is an example for what you are looking for PHP Code: |
| |
| | #3 |
| Active Warrior War Room Member Join Date: 2013 Location: Florida
Posts: 49
Thanks: 0
Thanked 4 Times in 4 Posts
|
Or you can use if you are using greater than php 5.3 $date = new DateTime(date("Y-m-d")); $date->modify('-15 day'); echo $date->format('Y-m-d'); |
| |
| | #4 |
| HyperActive Warrior Join Date: 2010
Posts: 267
Thanks: 5
Thanked 6 Times in 6 Posts
|
Hope this helps <?php echo date("jS F", strtotime('+15 days')); ?> |
|
Thanks & Regards, Reach us at dukeduke600@gmail.com. Web Design| Logo Design | Banner Design | Web Development | Mobile Applications [iPhone/iPad/Android/Windows Phone] | |
| |
| | #5 |
| Mobitech Join Date: 2012
Posts: 51
Thanks: 6
Thanked 2 Times in 2 Posts
|
<?php echo date("Y/m/d") . "<br>"; echo date("Y.m.d") . "<br>"; echo date("Y-m-d"); ?> output:: 2013/07/12 2013.07.12 2013-07-12 |
| | |
| |
|
| Bookmarks |
| Tags |
| date, function, php, required |
| Thread Tools | Search this Thread |
| |