Check dates against weekdays

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marioliveira
    New Member
    • Mar 2010
    • 1

    Check dates against weekdays

    I have a orm built with RSForms Pro in which there is a calendar. The form is about bookings for activities, some of which are not available every weekday. Is there a way of checking the date the clients chooses and display some kind of alert in case the activity he/hse is booking, does not take place in that weekday?
  • zorgi
    Recognized Expert Contributor
    • Mar 2008
    • 431

    #2
    Two functions you might find useful:

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Sure. Just take the dates (using the functions zorgi suggested) and compare them with the dates when the activity is available. Show an error if it is not.

      If you do:
      [code=php]$day = date('N', strtotime('2010-03-05'));[/code]
      You will get the number associated with today's weekday (6 for Friday). - You could just create a list of weekdays in which the activity is available, fetch the weekday the user selected and compare the two.

      Comment

      Working...