[Typo3-dev] convert timestamp to TYPO3 datetime
Peter Russ
peter.russ at 4dfx.de
Thu Sep 23 16:28:32 CEST 2004
Sacha Vorbeck wrote:
> Hi,
>
> I use the following code to generate a 10 digit unix timestamp:
>
> // $row['beginnz'] contains a string in this format: 18.30.00.000000
> $dateArrayStartZ = '';
> $dateArrayStartZ = t3lib_div::intExplode('.',$row['beginnz']);
> $timestampStartZ = mktime(($dateArrayStartZ[0]), ($dateArrayStartZ[1]));
> echo(date("G:i", $timestampStartZ));
>
> works.
>
> But when I paste this timestamp into a db-field for a TYPO3 datetime
> field, a non valid value is displayed.
>
> When I enter a time directly via the backend, TYPO3 generates a 5 digit
> timestamp.
>
> How can I convert my 10 digit unix timestamp into the 5 digit TYPO3
> timestamp correctly?
>
I would say the format for the Datetime is not quite ok:
http://dev.mysql.com/doc/mysql/en/DATETIME.html
Perhaps this helps.
Regs. Peter.
More information about the TYPO3-dev
mailing list