Re: String to Date and Date to String Functions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2005-01-24 at 11:03, Ben Edwards wrote:
> On Mon, 24 Jan 2005 10:38:03 -0600, Jay Blanchard
> <jay.blanchard@xxxxxxxxxxxxxxxxxxxxx> wrote:
> > [snip]
> > 
> > String to Date Function
> > ----------------------------
> > return date stringToDate( str Date, str Format )
> > e.g. $todayDt = stringToDate( '01/01/2003','DD/MM/YYYY' );
> > 
> > Date to String Function
> > ----------------------------
> > return str dateToString( date Date, str Format )
> > e.g. $todayStr = dateToString ( $todayDt,'DD/MM/YYYY' );
> > 
> > Anyone know of any functions that do this or have pointers as to how
> > it can be done.
> > [/snip]
> > 
> > You've looked at http://www.php.net/date ?
> > 
> Yes.  It douse the dateToString bit but how do I do the reverse.  I
> can use it to convert a timestamp to a string but how do I convert a
> string to a timestamp.
> 
> I must say i've used a few languages in my time and the PHP data/time
> functions are a mess.  Generaly when you find a function to do
> something to a data item there is an obvious way of reversing this
> (i.e. it has a simeler name).  This douse not seem to be the case with
> PHP;(


I have never come across something that I could not achieve using a
combination of mktime, date, time, and strtotime.  I think mktime is the
piece you are missing.  I have been irritated by date parsing in the
past but "If it works ... " 

HTH
Bret

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux