newphpbees Posted February 13, 2012 Share Posted February 13, 2012 Hi... Good day! I have table that has a field from_date and to_date. Now I just want to know if how can I display as table format the dates between from_date to_date. Like this from_date: 2011-12-16 to_date: 2011-12-31 I want to display it: 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 // table format. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/256982-display-dates-between-from-date-to-date/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 13, 2012 Share Posted February 13, 2012 <?php $from_date = '2011-12-16'; // get your dates from your table into php variables $to_date = '2011-12-31'; while($from_date <= $to_date){ echo $from_date . '<br />'; // produce and output what you want here... $from_date = date('Y-m-d',strtotime("$from_date + 1 day")); // increment the date } Quote Link to comment https://forums.phpfreaks.com/topic/256982-display-dates-between-from-date-to-date/#findComment-1317390 Share on other sites More sharing options...
newphpbees Posted February 13, 2012 Author Share Posted February 13, 2012 How can i displayed it in smarty template? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/256982-display-dates-between-from-date-to-date/#findComment-1317397 Share on other sites More sharing options...
PFMaBiSmAd Posted February 13, 2012 Share Posted February 13, 2012 That kind of depends on what your template is and how you want it to display. What have you defined you want and what have you tried when you attempted to do this yourself? Quote Link to comment https://forums.phpfreaks.com/topic/256982-display-dates-between-from-date-to-date/#findComment-1317401 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.