PHP already has a function that will convert a textual date into a unix
timestamp. 

-------------------------------------

strtotime
(3.0.12 - 3.0.18 only, PHP 4 >= 4.0.0)

strtotime --  Parse about any English textual datetime description into a
UNIX timestamp 
Description

int strtotime (string time [, int now])


The function expects to be given a string containing an English date format
and will try to parse that format into a UNIX timestamp relative to the
timestamp given in now, or the current time if none is supplied. Upon
failure, -1 is returned. 

-------------------------------------

You can then use the PHP function date() to format the unix timestamp as a
mySQL timestamp, or you can use the mySQL function FROM_UNIXTIME to so the
same.

I have used strtotime() to convert the textual datetime exported from MSSQL
into a unix timestamp successfully.

Bernt.

-----Original Message-----
From: Iain Lang [mailto:limpingwithbothfeet@;metro800.co.uk]
Sent: Thursday, October 17, 2002 10:26 AM
To: Serge Paquin; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: Date Woes


.
Could we see this php routine, please?  Or can you post it to a newsgroup?

Yooors,

Iain Lang.

At 18:23 15/10/02 -0400, Serge Paquin wrote:
>I have written a very poor and inflexable PHP function to do this outside
>the database.  I have not played with doing my own functions in mySQL but
>your suggestion is well taken.  I believe that I will attempt to create a
>function for mySQL that is more compatible and flexable.  Good suggestion
>not sure why I didn't think of it :)
>
>Serge.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to