开发者

validating time and date fields

Is there any way to validate the time field based on the current time. I already posted a simillar question but now i decided to move away from that option and just want to try this.

1) ask an user to select time (I am using jquery timepicker). 2) See if that time is future time and not which is already gone.

I also have a datepicker, so if there is a way to check the time for that date then that would be great. For example, if one user select "august 10 2010(todays date)" from the date picker and then select time using timepicker, let say user select 6am ,开发者_开发技巧 is there any way to see if that time for that date is already gone? because that user cannot choose a time which is already gone. I am fine if there is any php solution to take these two fields and see if it's a valid entry or not. Please guide me.

I just found that the date picker for the current and future date is working based on system date, I had my system date changed to aug 6th and the date picker started showing from Aug 6th. Any idea if this can be fixed?


You can use mktime() to solve all of those problems. It will create a unix timestamp if the date is correct (otherwise it will return false). And you can also check if the value is greater than the current timestamp (using the time() function).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜