Re: Proposed new package: Time.

From: Date: Fri, 21 Feb 2003 13:46:07 +0000
Subject: Re: Proposed new package: Time.
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-13550@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Wolfram Kriesing, el viernes 21 de febrero a las 14:33 me escribiste: > >The string conversions uses strtotime(), I don't think it works with > >string "import", but you can use another methods like (from the complex > >example): > >$t['pi_h'] =& new Time(); > >$t['pi_h']->setFromHours(pi()); > >$t['pi_m'] =& new Time(); > >$t['pi_m']->setFromMinutes(pi()); > >$t['pi_s'] =& new Time(); > >$t['pi_s']->setFromSeconds(pi()); > > > >Prints: > >03:08:30 > >00:03:08 > >00:00:03 > > i dont know if i understand it wrong or if i misexplained it. > > i mean converting a decimal number of hours, like 2.5 hours (2 and a > half hours) to the "hour format" which would be 2:30 (2 hours and > thrity minutes) and alikes Yes! pi() (3.1415..) is a decimal number of hours :) What you want is exxactly this: $t =& new Time(); $t->setFromHours(2.5); echo $t->toString('%H:%M'); Results: 02:30 I just wanted to show you that you can convert a decimal number of minutes and seconds too... - -- LUCA - Leandro Lucarella - Usando Debian GNU/Linux Sid - GNU Generation - ------------------------------------------------------------------------ E-Mail / JID: luca@lugmen.org.ar GPG Fingerprint: D9E1 4545 0F4B 7928 E82C 375D 4B02 0FE0 B08B 4FB2 GPG Key: gpg --keyserver pks.lugli.org.ar --recv-keys B08B4FB2 - ------------------------------------------------------------------------ :----------------------------------) ¡Pinocho! ¿Qué habrás hecho? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+Vi2fSwIP4LCLT7IRAjk5AJ4pRPAJ1A1kbUF0in0IHo/M4nJW8gCePE+D wdHM9aDHbjVkIACW0pqtwZE= =rItU -----END PGP SIGNATURE-----

« previous php.pear.dev (#13550) next »