Welcome Guest, Not a member yet? Register   Sign In
Need HELP: Date Calculation :(
#1

[eluser]Unknown[/eluser]
Hello ALL

Suppose there is a date like '2007-01-01'. when a user input month (say 5), it will calculate the 5 month previous/backward "date".

Thx in Advance
Smile
#2

[eluser]Michael Wales[/eluser]
Code:
// Go backwards from today (according to your config.php setting)
// $modifier is the # of months to go back
$this->load->helper('date');
echo date('Y-m-d', strtotime('-' . $modifier . ' months', mysql_to_unix(now())));




Theme © iAndrew 2016 - Forum software by © MyBB