RE: [PHP] MySQL timestamp to desired date function
| From: | Cesar Aracena | Date: | Thu, 18 Sep 2003 05:12:35 +0000 |
| Subject: | RE: [PHP] MySQL timestamp to desired date function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162954@lists.php.net to get a copy of this message | ||
Sure. One result is 20030918014916. That sound like YYYYMMDDHHMMSS to me
right?
Thanks,
Cesar Aracena
www.icaam.com.ar
-----Mensaje original-----
De: Cody Phanekham [mailto:Cody.Phanekham@salmat.com.au]
Enviado el: Jueves, 18 de Septiembre de 2003 02:04 a.m.
Para: php-general@lists.php.net
Asunto: RE: [PHP] MySQL timestamp to desired date function
[snip]
> I have a a timestamp in a DB (14 digits)
[/snip]
strtotime() tries to convert textual dates into a UNIX timestamp. eg "10
September 2000"
since you've supplied a 14 digit timestamp to strtotime(), the function
will throw back unexpected results.
can we get some sample data from the lugar_lastinsert field?
> -----Original Message-----
> From: Cesar Aracena [mailto:lists@icaam.com.ar]
> Sent: Thursday, 18 September 2003 14:39
> To: php-general@lists.php.net
> Subject: [PHP] MySQL timestamp to desired date function
>
>
> Hi all,
>
> I have a a timestamp in a DB (14 digits) that I want to display like I
> want in my pages. I tried to use strtotime, mktime and date functions
> with no success... it always return the current timestamp
> instead of the
> one I have stored. This is what I've done so far:
>
> for ($x = 0; $x < $num_rows; $x++)
> {
> $row = mysql_fetch_array($result);
> $date1 = strtotime($row[lugar_lastinsert]);
> $date2 = date("d \de m \de Y \a \l\a\s H:i:s",
> mktime($date1));
> echo "<tr>";
> echo "<td>";
> echo $row[lugar_name]." - ".$row[lugar_specific];
> echo "</td>";
> echo "<td align=\"center\">";
> echo $date2;
> echo "</td>";
> echo "</tr>";
> }
>
> How can I do this and make it work?
>
> Thanks in advanced,
>
> Cesar Aracena
> www.icaam.com.ar
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
************************************************************************
*************
This e-mail, including any attachments to it, may contain confidential
and/or personal information.
If you have received this e-mail in error, you must not copy,
distribute, or disclose it, use or take any action
based on the information contained within it.
Please notify the sender immediately by return e-mail of the error and
then delete the original e-mail.
The information contained within this e-mail may be solely the opinion
of the sender and may not necessarily
reflect the position, beliefs or opinions of Salmat on any issue.
This email has been swept for the presence of computer viruses known to
Salmat's anti-virus systems.
For more information, visit our website at www.salmat.com.au.
************************************************************************
*************
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php