Bopo Posted April 20, 2009 Share Posted April 20, 2009 Hi Basically I have a very simple query for now (just testing( <?php $sql = "SELECT * FROM blogposts WHERE date >= '2009-04-14' AND date <='2009-04-18'"; ?> This query will be executed when a hyperlink is clicked, the script will have access to two pieces of data from the URL as so: www.website.com/archive?month=April&year=2009 I would like to know if there is some function out there that could convert April for example into 04, I'm quite confident with the days and years aspect of the date, however it would be really useful if I could convert the month name into it's numerical format. Link to comment https://forums.phpfreaks.com/topic/154819-dates-query-question/ Share on other sites More sharing options...
teynon Posted April 20, 2009 Share Posted April 20, 2009 http://www.php.net/manual/en/function.date.php - For returning values. http://www.php.net/manual/en/function.strtotime.php - For interpreting dates. date("YmdHis", strtotime($date)); Where YmdHis is however you want it to output. Read the date function on php.net for details. Link to comment https://forums.phpfreaks.com/topic/154819-dates-query-question/#findComment-814244 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.