Forum Moderators: coopster

Message Too Old, No Replies

comparing to time values

         

msthac01

10:53 pm on Feb 8, 2008 (gmt 0)

10+ Year Member



I have a page where the users can input a follow up date and time. The issue is that these are 2 separate fields, what I need to do is when the user inputs a date and time I need to compare it to the previous date/time that was entered if there was one and then make sure that the new entry is a later date/time then the previous entry. ie if the previous entry was 2/08/2008 at 3pm and the user inputs 2/08/2008 2:20pm then it would trigger a message to let the user know that they must input a time that is later than the previous time. How can I accomplish this:

1. Put the date and time fields together into one field that is still a valid date/time value

2. Compare the two(I know I'll be using javascript for this part and I believe I already have the script to compare the dates just need to get the values into a date/time variable for comparison)

GamingLoft

12:34 am on Feb 9, 2008 (gmt 0)

10+ Year Member



Do you have any php knowledge, just wondering?

php date function...

[php.net...]

also maybe try timestamps.

GamingLoft

3:55 am on Feb 9, 2008 (gmt 0)

10+ Year Member



Also (sorry bout double post but post edit time ended) how are you saving the first date variable? is it in the url or in a session or something? because that'd be something people need to know.

msthac01

2:37 pm on Feb 11, 2008 (gmt 0)

10+ Year Member



The form data fields are being save in a MySQL database as separate fields