Forum Moderators: coopster

Message Too Old, No Replies

How i can Compare between two Date Variables using PHP

         

nassar

9:07 am on Feb 13, 2005 (gmt 0)

10+ Year Member



Dear All,
I hope i can get help to solve my following problem.

I've HTML Form contain Date Field, i use it to store upcoming Events.

i'll Check Posted Date, if it Equal or Bigger than Current Date i'll store it into DB else i'll display error MSG.

I need to compare HTML Date (Date Variable Came From HTML Form).

I want to Compare HTML date with Couurent Date.
Date like this : 2005-01-09 // yyyy-mm-dd

How i can deal with posted date and current date as date not string? How i can Do comparing between this two Variables?

i try to do this by comparing Year with Year, Month with Month, Day with Day...., but it's confused me.

So i like to receive your suggestions, opinions.

CoOL Greetings 2 All.

Nassar

dreamcatcher

10:36 am on Feb 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World nassar.

What you need to look into are the PHP date [uk2.php.net] functions.

To compare the data you have specified, use:

date("Y-m-d");

Hope that helps.

nassar

2:41 pm on Feb 13, 2005 (gmt 0)

10+ Year Member



Hi dreamcatcher
thx a lot, when i browse this website i see last thread with same problem / [webmasterworld.com...] /

it is Ok now, thanls a lot.

CoOL Greetings
Nassar