I've been trying for about 2 days with 12 hour stretches of time trying to solve this problem and am completely out of energy after not getting anywhere so please help with any information you may have.

Basically, for the website I've built, there is a box which is placed on there which asks the user to enter the date they'd like to book an appointment, and they cannot book this appointment in advance over 3 months. So what I've tried doing is get the date now, then get the date of 3 months in the future then i need to compare the date entered today and make sure it does not exceed 3 months, if it does then an error message is echoed if not a success message is echoed. but every time i have tried this I ended up with nothing. I've even tried converting to seconds using "strtotime" but no luck with anything.

Please specify a simple way of doing this PLEASE!!!

6 Years
Discussion Span
Last Post by chrishea

It would be simpler to use 90 days than three months. If you have today's date (as a timestamp), calculate 90 days in seconds, add that to today's date, then compare the result to the timestamp for the date they entered; that will tell you if it is beyond 3 months or not.


would you mind explaining how a time stamp works? these online tutorials are really badly worded


The (unix) timestamp is defined as "...the number of seconds elapsed since midnight Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds".

Thus, it is a relative time in seconds. If you subtract one timestamp from another, you get the number of seconds between the two dates-times. You can convert a date to a timestamp with strtotime and you can convert a timestamp to a formatted date with the Date command.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.