Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCalvin . T Rupango
6,083 Pointsworking with dates
Can anyone help me with my qn as it fails to run i dont know why but its saying the date format is wrong.. The challenge link is https://teamtreehouse.com/library/crud-operations-with-php/reading-and-writing-reports/working-with-dates
my solution that i have done as follows: <?php
function convert_date_sql($date) { //add your code here $date = strtotime($date); $date = date('yyyy-mm-dd',$date); return date("Y-m-d", strtotime($date));
}
Please help me out.
<?php
function convert_date_sql($date) {
//add your code here
$date = strtotime($date);
$date = date('YYYY-MM-DD',$date);
return date("Y-m-d", strtotime($date));
}
1 Answer
Robert Kulagowski
4,954 PointsHave you tried removing the intermediate steps and just using the "return" line by itself?
I just tried
return date("Y-m-d", strtotime($date));
And got a "Congrats" from the page.