Orionsbelter Posted April 1, 2010 Share Posted April 1, 2010 Hi there, i'm a newbie to PHP coding i understand the basics of php dates but i have not used it that much. However i'm currently making a new website whereas i seem to be using the date function alot. I'm in the UK and so is the Website so i'm using gmdate functions. However i would like to know if there is any tutorials about using dates to a advanced extend. I would start to make scripts that will show results of maybe news posted between Y Date - X Date! however i can store the dates in the database but can not make a script that will for example only echo results for Y Date - X Date! Or maybe a script that would only show news from march 2010. If show one can show me how or provide links to articles i will be very thankful. Thank you for reading Quote Link to comment https://forums.phpfreaks.com/topic/197280-php-dates-need-some-help-please/ Share on other sites More sharing options...
ignace Posted April 2, 2010 Share Posted April 2, 2010 SET GLOBAL time_zone = <timezone>; -- if something different from SYSTEM or if you SQL server is not hosted on the same server as your PHP SELECT * FROM table WHERE date BETWEEN date_y AND date_x SELECT * FROM table WHERE month(date) = 3 -- March Quote Link to comment https://forums.phpfreaks.com/topic/197280-php-dates-need-some-help-please/#findComment-1035796 Share on other sites More sharing options...
harristweed Posted April 2, 2010 Share Posted April 2, 2010 I think you need to look at mysql for date if from database rather than php http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html Quote Link to comment https://forums.phpfreaks.com/topic/197280-php-dates-need-some-help-please/#findComment-1035804 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.