Re: Problems with date function
| From: | Lerp | Date: | Fri, 01 Feb 2002 18:19:57 +0000 |
| Subject: | Re: Problems with date function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-83157@lists.php.net to get a copy of this message | ||
Hi there :) Check this out. It grabs the date from your table, and uses the
mktime and date functions to format the date properly :)
//format the gamedate for display below
$month = substr($gamedate, 5, 2);
//print $month . "<BR>";
$day = substr($gamedate, 8, 2);
//print $day . "<BR>";
$year = substr($gamedate, 0, 4);
//print $year . "<BR>";
$gamedateinsecs = mktime(0,0,0,$month, $day, $year);
$formattedgamedate = date('F j Y',$gamedateinsecs);
//print $formattedgamedate;
Hope this helps you out :)
Joe / Lerp :)
"Jorge Arechiga" <jarechiga@corp.opcion.net> wrote in message
news:21B9FB8DEA88D41195890050BF064487093C9E@CORREO...
Hi everybody
I hope someone can help me in an issue on where i've been stuck for a while.
I'm trying to show a date from a Table in SQLServer7
when i use this :
<tr><td align="right" width="60%"><? echo
(odbc_result($resultd1,'date1'));?></td></tr>
the browser shows me the date correctly and the result is this: 2002-02-01
11:31:00
Obviously i want to format the date so i use the date() function and the
code is like this:
<tr><td align="right" width="60%"><? echo date("m d
Y",odbc_result($resultado,'fechaasignacion'));?></td></tr>
But when i want to see the date in the browser the date doesn´t match with
the real date and the result is this:
12 31 1969
Does anybody knows how coul i fix this, so the displayed date matches with
the one that is in the database?
Thank a lot
George