You can use strtotime function.  It'll take any textual rep of a date and
convert it to Unix Timestamp.  Then your checks will be int based.

You can then use Date() to format it back to your liking, etc.
-- 
Scott Carr
OpenOffice.org
Documentation Maintainer
http://documentation.openoffice.org/


Quoting Dash McElroy <[EMAIL PROTECTED]>:

> Well... you could cut the string down like:
> 
>   $string = substr("$string", 0, 9);
> 
> then explode them into an array like follows:
> 
>   $array = explode("-", "$string");
> 
> and then...
> 
>   $dbdate = date("m/d/Y", mktime(0,0,0,$array[1],$array[2],$array[0]));
> 
> then do your compare.
> 
> OR - you could just compare the two mktime calls (i.e. the mktime call above
> and then compare it with a mktime call with the current (or user specified)
> date).
> 
> PHEW!
> 
> Good luck!
> 
> -Dash
> 
> -----Original Message-----
> From: Kit Kerbel [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, July 25, 2002 12:05 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] Date conversion
> 
> 
> I'm pulling the "2002-04-02 00:00:00" from a database(mssql).  It reads 
> 04/02/2002 in the database table, but when you pull the value out with php, 
> it converts it to 2002-04-02 00:00:00.  Then I am trying to compare it with 
> 7/11/2002 to see if it is > or <.  It's not comparing properly. Not sure 
> what to do.  Seems kinda like a stupid sticking point.
> 
> Kit
> 
> 
> ----Original Message Follows----
> From: Dash McElroy <[EMAIL PROTECTED]>
> To: 'Kit Kerbel' <[EMAIL PROTECTED]>
> Subject: RE: [PHP-WIN] Date conversion
> Date: Thu, 25 Jul 2002 10:02:03 -0700
> 
> How is the string 2002-04-02 00:00:00 entered? Is that generated by a
> database, a PHP function, or user input on a website?
> 
> The mktime(); function can probably help you, but take a look at it's funky
> paramaters. When you're done with mktime();, pass it to date(); with the
> paramaters you want (i.e. date(mdy, mktime(blah blah blah));
> 
> Good luck!
> 
> -Dash
> 
> -----Original Message-----
> From: Kit Kerbel [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 25, 2002 8:44 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Date conversion
> 
> 
> I would like to convert 2002-04-02 00:00:00  to the format,
> 04-02-2002....or m/d/Y
> 
> How would I do this?
> 
> Thanx in advance,
> Kit
> 
> 
> 
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
> 
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

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

Reply via email to