NLCJ Posted September 22, 2010 Share Posted September 22, 2010 Hello, I've been struggling for days on this problem now. And I'm getting frustrated! I know that the answer is simple, and I've done it before but I cannot figure out what I'm doing wrong. What do I want? Well, I get a date from the database in this format: YYYY-MM-DD. I first want to distract one month from that and then set in into this form: YYYY, MM, DD. I've got this but it's not working (I've tried a lot different values). $transformdate = date("Y-m-d", strtotime("-1 month", $d_datevalue)); $startpoint = str_replace("-", ", ", $transformdate); Thanks, NLCJ Quote Link to comment Share on other sites More sharing options...
adam84 Posted September 22, 2010 Share Posted September 22, 2010 $myDate = explode('-', $row['date'] ); $monthLess = date( "Y-m-d", mktime(0,0,0 ,$myDate[1] - 1 ,$myDate[2],$myDate[0]) ); Something like that Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted September 22, 2010 Share Posted September 22, 2010 $startpoint = date("Y, m, d", strtotime("$d_datevalue -1 month"); Quote Link to comment Share on other sites More sharing options...
NLCJ Posted September 22, 2010 Author Share Posted September 22, 2010 Thanks a lot! (Both of you) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.