RE: [PHP] date check

2003-03-12 Thread Niklas Lampén
$FourteenDays = 86400 * 14;
$var = $FourteenDays - (strtotime($date2) - strtotime($date1));

Now if $var is  0, 14 days has not passed.


Niklas

-Original Message-
From: Fredrik [mailto:[EMAIL PROTECTED] 
Sent: 12. maaliskuuta 2003 12:06
To: [EMAIL PROTECTED]
Subject: [PHP] date check


Hi

I want to check if  $var  14 days or $var   14 days

($var = $date2  - $date1)

$date1 = 2003-01-16;
$date2 = 2003-03-16;


How can i check this?
Are there any functions for this or do i have to make one?





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail. For
more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Date check

2003-02-11 Thread Jon Haworth
Hi Fredik,

 I have to dates that i want to check who is biggest.
 
 This does not work:
 if( $date1  $date2){
 
 
 How can i check them?

Presumably they're in SQL format, or something similar? 

The easiest way is to convert them to unix timestamps (look into the date()
and mktime() functions to see how this is done).

Timestamps are integers representing the number of seconds since 1st January
1970, so comparisons are extremely easy :-)

Cheers
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php