Re: timestamp problem !!
| From: | myhan | Date: | Tue, 15 Jul 2003 00:49:27 +0000 |
| Subject: | Re: timestamp problem !! | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-155203@lists.php.net to get a copy of this message | ||
mysql's timstamp in this case is in the format:
YYYYMMDDHHMMSS
and it's default value is current time.
| TIMESTAMP(14) | YYYYMMDDHHMMSS |
| TIMESTAMP(12) | YYMMDDHHMMSS |
| TIMESTAMP(10) | YYMMDDHHMM |
| TIMESTAMP(8) | YYYYMMDD |
| TIMESTAMP(6) | YYMMDD |
| TIMESTAMP(4) | YYMM |
| TIMESTAMP(2) | YY |
After having some trouble checking deltas between DB-Timestamps and my
server time, I use this to convert something like a MySQL-Timestamp(14) to
the UNIX format:
$Timestamp="20030423145607";
$UnixTimestamp = strtotime (substr_replace (substr (substr
($Timestamp,0,2).chunk_split (substr ($Timestamp,2,6),2,"-").chunk_split
(substr ($Timestamp,8),2,":"),0,19)," ",10,1));
"Curt Zirzow" <curt@zirzow.dyndns.org>
??????:20030714211135.GD45640@bagend.shire...
> Nabil <nabil.attar@aws-syria.com> wrote:
> > thanks Jason, you've been always helping me ...
> >
> > Please i still have some fog regading this.. can u expaling me more
about
> > the timestamp and unix timestamp...
>
> mysql's timstamp in this case is in the format:
> YYYYMMDDHHMMSS
>
> Unix timstamp number of seconds since 1970-01-01
>
> > and regaring me issue i have a string with '20030714012548' what ever i
got
> > it from (because i m getting this from MSSQL some time and then read it
from
> > MySQL, and i need to desplay it in as 2003-07-14 only ..
> >
> > What' shall i do ?
>
> Read:
> http://www.mysql.com/doc/en/Date_and_time_functions.html
> http://www.mysql.com/doc/en/DATETIME.html
>
>
> > Nabil
> >
>
> Curt
> --