Or if you are retrieving the data from a database, use the SQL Date-Time functions
(RTFM).
=dn
- Original Message -
From: "Rafael Perazzo B Mota" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 26 January 2002 16:38
Subject: [PHP] Re:[PHP] Changeing Dates.
function ChangeDate ($date) {
$day=substr($date,6,2); //get the day
$month=substr($date,4,2); //get the month
$year=substr($date,0,4); //get the year
$time=substr($date,8,4); //get the time
$secs=substr($date,12,2); //get the seconds
$ret="$day $month $year @ $time h $secs s"
Hi, provided that your initial string will always be in the same format
(same # of numbers) I would use the substr function. substr(string, start,
[length])
Ex:
$mystring = "20020124020555";
$year = substr($mystring,0,4);
$month = substr($mystring,4,2);
$day = substr($mystring,6,2);
etc...
Hope
3 matches
Mail list logo