Re: String to Date and Date to String Functions?

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

 



On Tuesday 25 January 2005 03:01, Ben Edwards wrote:

> Being trying to work out haw to handle dates.  Basically I need a
> function to convert a Date to a String and another function to convert
> a string to a date.
> 
> Exactly what format the date is held in is not relevant as long as it
> is some type of  standard (i.e. Unix Timestamps).
> 
> Both the functions will require a format string (such ad DD/MM/YYY)
> and again the format/syntax of this is irrelevant, as long as they are
> the same for both .
> 
> 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.
> 
> Ben

Have you looked at date() and strtotime() ?

-- 
David Robley

How do you make Windows faster ? Throw it harder

-- 
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