Re: [PHP] Formatting time :/

2007-01-02 Thread Richard Lynch
If it is stored in a database, you may want to convert within your query:
MySQL: date_format
Postgresql: to_char

If it's just in a text file, PHP's date() function should do it:
http://php.net/date

I dunno if there's a nifty constant for the format you want, but you
could always mess with mktime and date to get what you want.
http://php.net/mktime

On Tue, January 2, 2007 6:39 am, Steven Macintyre wrote:
> Hi all,
>
> I am unable to find out how to do this ... or what the format is
> "called"
> bar zulu format
>
> I have standard 00:00:00 time stored ... and wish to display it as
> 00h00 ...
> has anyone done this with php ... can you point me to right page etc
> ...
>
> What is that format called?
>
>
>
> Kind Regards,
>
>
> Steven Macintyre
> http://steven.macintyre.name
> --
>
> http://www.friends4friends.co.za
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Formatting time :/

2007-01-02 Thread Steven Macintyre
Thanks Stut,

Perfect!


Kind Regards,


Steven Macintyre
http://steven.macintyre.name
--

http://www.friends4friends.co.za


> -Original Message-
> From: Stut [mailto:[EMAIL PROTECTED]
> Sent: 02 January 2007 02:59 PM
> To: Steven Macintyre
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Formatting time :/
> 
> Steven Macintyre wrote:
> > I am unable to find out how to do this ... or what the format is
> "called"
> > bar zulu format
> >
> > I have standard 00:00:00 time stored ... and wish to display it
> as 00h00 ...
> > has anyone done this with php ... can you point me to right page
> etc ...
> >
> > What is that format called?
> 
> http://php.net/date
> 
> $time = date('H\hi', strtotime('00:00:00'));
> 
> Or, if the input format is always the same, you could do it like
> so...
> 
> $time = str_replace(':', 'h', substr('00:00:00', 0, 5));
> 
> -Stut
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Formatting time :/

2007-01-02 Thread Stut

Steven Macintyre wrote:

I am unable to find out how to do this ... or what the format is "called"
bar zulu format

I have standard 00:00:00 time stored ... and wish to display it as 00h00 ...
has anyone done this with php ... can you point me to right page etc ...

What is that format called?


http://php.net/date

$time = date('H\hi', strtotime('00:00:00'));

Or, if the input format is always the same, you could do it like so...

$time = str_replace(':', 'h', substr('00:00:00', 0, 5));

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Formatting Time

2002-05-15 Thread Analysis & Solutions

Devin:

> I want to a kewl script that will format time from seconds. I have a script
> that returns the number of seconds a person has been an employee and
> I want to format it in human readable format like:
> 
> 1 year 6 months 14 days, etc.

Start with the manual:

http://www.php.net/manual/en/ref.calendar.php
http://www.php.net/manual/en/ref.datetime.php

--Dan

-- 
   PHP classes that make web design easier
SQL Solution  |   Layout Solution   |  Form Solution
sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Formatting Time

2002-05-15 Thread Miguel Cruz

On Wed, 15 May 2002, Devin Atencio wrote:
> I want to a kewl script that will format time from seconds. I have a script
> that returns the number of seconds a person has been an employee and
> I want to format it in human readable format like:
> 
> 1 year 6 months 14 days, etc.

Say you had 18001 seconds. How would you figure out how many minutes that
was? Do you know how many seconds there are in a minute? And once you had
the minutes, how would you figure out how many hours that was? Do you know
how many minutes there are in an hour? I hate to be condescending, but I
think they teach this sort of thing in school around age 7.

Of course, you can only go up to weeks this way. It's not possible to
accurately calculate months or years from an abstract number of seconds
(without knowing the starting date and time) because months and years have
varying lengths. You could average it out by saying a month is 30 days and 
a year is 365.25 days but that's ever so slightly off (only matters when 
you get into hundreds of years).

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php