holy24 Posted December 3, 2012 Share Posted December 3, 2012 Hi, I am trying to use the strtotime() function, but I am not sure how to get the result if I include a date manually. Example 1: If I get the default date today (03/12/2012), the below code will add 1 day so the output will be 04/12/2012 which is correct. date("d-m-Y",strtotime("+1 day")); Example 2: If user entered a date (eg. 01/12/2012), i tried below code it will give me 02/01/1970. The result should be 02/12/2012. date("d-m-Y",strtotime("+1 day", "01/12/2012")); Thanks in advance for the help. Link to comment Share on other sites More sharing options...
Ingolme Posted December 3, 2012 Share Posted December 3, 2012 The second parameter of strtotime() has to be a date in UNIX timestamp format. You can't pass a string and expect it to understand it. Link to comment Share on other sites More sharing options...
thescientist Posted December 3, 2012 Share Posted December 3, 2012 http://php.net/manual/en/function.strtotime.php Link to comment Share on other sites More sharing options...
holy24 Posted December 4, 2012 Author Share Posted December 4, 2012 Thanks guys..The problem is solved. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now