String to Date and Date to String Functions?
| From: | Ben Edwards | Date: | Mon, 24 Jan 2005 16:31:44 +0000 |
| Subject: | String to Date and Date to String Functions? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-207128@lists.php.net to get a copy of this message | ||
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
--
Ben Edwards - Poole, UK, England
WARNING:This email contained partisan views - dont ever accuse me of
using the veneer of objectivity
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)