Re: Time Formatting

From: hodges(at)xprt(dot)net
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Time Formatting
Date: 2002-05-10 03:30:17
Message-ID: 3CDADC59.2889.F1653F@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have 3 queries and some php to run them. What I need is
to display the time in a HH:MM am format. Doesn't need to
be stored that way in the table?

These two add or update records:

insert into feasts (timestamp, date, time, address, direction,
host, phone)
values ('current_timestamp', '$date', '$time','$addr',
'$directions','$host','$phone');

update feasts set date='$date', time='$time', host='$host',
phone='$phon', address=$addr','direction='$directions'
where feast_id='$feast_id';

These retrieve and display records:

select * from feasts;

$time = $result->fields[3];

and in a form,
print ("<INPUT TYPE= \"text\" NAME=\"time\" VALUE= \"$time\"><BR>\n");
and
print ("<INPUT TYPE= \"text\" NAME=\"time\">\n");

So I am not sure how to do this.

Thanks,
Tom

On 9 May 2002 at 20:55, Larry Rosenman wrote:

> On Thu, 2002-05-09 at 20:37, hodges(at)xprt(dot)net wrote:
> > Is there a builtin function in Postgres to display the
> > time as XX:XX am or XX:XX pm?
> >
> look at the to_char function on
> http://www.lerctr.org/postgresql/functions-formatting.html
>
> (this is my copy of the docs).
>
>
> > Cheers, Tom Hodges
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 3: if posting/reading through Usenet, please send an appropriate
> > subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> > message can get through to the mailing list cleanly
> >
> --
> Larry Rosenman http://www.lerctr.org/~ler
> Phone: +1 972-414-9812 E-Mail: ler(at)lerctr(dot)org
> US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Elphick 2002-05-10 09:28:39 Re: Converting epoc number to timestamp
Previous Message Larry Rosenman 2002-05-10 01:55:32 Re: Time Formatting