Reply to Re: Getting date (timestamp) as time value?

Your name:

Reply:


Posted by Kimmo Laine on 12/05/06 09:04

"Sonnich" <sonnich.jensen@elektrobit.com> wrote in message
news:1165309352.222966.35270@16g2000cwy.googlegroups.com...
>
> Kimmo Laine wrote:
>> "Sonnich" <sonnich.jensen@elektrobit.com> wrote in message
>> news:1165307408.725039.279250@f1g2000cwa.googlegroups.com...
>> > I'd like to read out a date from the a DB, but as time var. By default
>> > I seem to get it as a string.
>> >
>> > E.g.
>> > while(odbc_fetch_row($result))
>> > {
>> > $tt= odbc_result($result,2);
>> > echo date("d.m.Y", $tt).", ".odbc_result($result,6) . " <br>";
>>
>>
>> What kind of a string it is? If it's just a regular Y-m-d string, then
>> the
>> easiest would be first converting it to unix timestamp and then passing
>> that
>> to date:
>> date("d.m.Y", strtotime($tt));
>>
>> strtotime parses the formatted date string and converts it to integer.
>
> Server default format, I guess....
> 2006-12-05 00:00:00

Then strtotime is your friend. Just pass the timestring the server gives to
strtotime and use the timestamp it returns.


--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация