pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedTimestamp problem
6+ messages / 6 participants
[nested] [flat]
* Timestamp problem
@ 2000-07-10 18:52 Bernie Huang <bernie.huang@ec.gc.ca>
0 siblings, 1 reply; 6+ messages in thread
From: Bernie Huang @ 2000-07-10 18:52 UTC (permalink / raw)
To: pgsql-sql
Hi,
I have Postgres 7.0, and I created a table
table
---------
...
borrow timestamp
return timestamp
Now, I thought timestamp is in sec eg; 35434434, but in PostgreSQL, it
shows up as datetime datatype eg; 2000-06-07 17:00:05-07.
I was wondering is this format a correct one for timestamp, or is it a
bug? Abd if I want to show the time, each retrieval I have to chop of
the '-07' timezone at the end. Is there a way to avoid this being show
up in Postgres?
Thanks.
- Bernie
Attachments:
bernie.huang.vcf (text/x-vcard, 314B) download
begin:vcard
n:Huang;Bernie
tel;fax:(604)664-9195
tel;work:(604)664-9172
x-mozilla-html:TRUE
org:Environment Canada;Standards and Technology Services
adr:;;700-1200 West 73 Ave.;Vancouver;BC;V6P 6H9;Canada
version:2.1
email;internet:bernie.huang@ec.gc.ca
title:Programmer
x-mozilla-cpt:;0
fn:Bernie Huang
end:vcard
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Timestamp problem
@ 2000-07-10 19:07 Ed Loehr <eloehr@austin.rr.com>
parent: Bernie Huang <bernie.huang@ec.gc.ca>
0 siblings, 0 replies; 6+ messages in thread
From: Ed Loehr @ 2000-07-10 19:07 UTC (permalink / raw)
To: Bernie Huang <bernie.huang@ec.gc.ca>; +Cc: pgsql-sql
Bernie Huang wrote:
>
> table
> ---------
> ...
> borrow timestamp
> return timestamp
>
> Now, I thought timestamp is in sec eg; 35434434, but in PostgreSQL, it
> shows up as datetime datatype eg; 2000-06-07 17:00:05-07.
>
> I was wondering is this format a correct one for timestamp, or is it a
> bug? Abd if I want to show the time, each retrieval I have to chop of
> the '-07' timezone at the end. Is there a way to avoid this being show
> up in Postgres?
You might want to check out the date/time and formatting functions at
http://www.postgresql.org/docs/postgres/index.html
Regards,
Ed Loehr
^ permalink raw reply [nested|flat] 6+ messages in thread
* Timestamp problem
@ 2002-06-11 20:40 kumar <kumar@cc.usu.edu>
0 siblings, 1 reply; 6+ messages in thread
From: kumar @ 2002-06-11 20:40 UTC (permalink / raw)
To: pgsql-sql
Hai All,
I have been using Mysql in which I used unix_timestamp() function
to retrieve the time using the queries. As it gives time in seconds the life
is easy to store it in database and to compare with the other times. But now I
am moving to PostgreSQL in which there is a function current_timestamp to
retrieve time, but now it became hard for me to store it in database in the
string format and to compare it with other times again.
Is there any function in PostgreSQL which returns time in
seconds like unix_timestamp() in Mysql. Please suggest me some ways to get rid
of this problem.
My email: kumar@cc.usu.edu .
Thank you All,
Kumar.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Timestamp problem
@ 2002-06-12 14:57 Stephan Szabo <sszabo@megazone23.bigpanda.com>
parent: kumar <kumar@cc.usu.edu>
0 siblings, 0 replies; 6+ messages in thread
From: Stephan Szabo @ 2002-06-12 14:57 UTC (permalink / raw)
To: kumar <kumar@cc.usu.edu>; +Cc: pgsql-sql
On Tue, 11 Jun 2002, kumar wrote:
> Hai All,
>
> I have been using Mysql in which I used unix_timestamp() function
> to retrieve the time using the queries. As it gives time in seconds the life
> is easy to store it in database and to compare with the other times. But now I
> am moving to PostgreSQL in which there is a function current_timestamp to
> retrieve time, but now it became hard for me to store it in database in the
> string format and to compare it with other times again.
What is the specific problem you're having? Do you have an example that
illustrates it?
In general, I don't know why you'd want to store the timestamp as a string
rather than a timestamp.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Timestamp problem
@ 2003-07-15 19:15 Raymond Chui <raymond.chui@noaa.gov>
0 siblings, 1 reply; 6+ messages in thread
From: Raymond Chui @ 2003-07-15 19:15 UTC (permalink / raw)
To: pgsql-jdbc@postgresql.org; pgsql-sql; pgsql-bugs@postgresql.org; pgadmin-support@postgresql.org.
I am use PostgreSQL 7.2.1 in Redhat Linux 7.2
Java 1.4.x
When I do JDBC
String sql = "SELECT datetime_column FROM mytable";
....
Timestamp ts = resultSet.getTimestamp(2);
If the timestamp return format like
2003-07-15 13:20:00.20+00
then is OK. But if timestamp return like
2003-07-15 13:20:00.421+00
Then I got SQLException
Bad Timestamp Format at 23 in 2003-07-14 14:45:00.421+00
What is 23?
How do I resolve this problem?
Thank Q!
--
Raymond Chui
NWS at NOAA
301-713-0640 ext 168
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Timestamp problem
@ 2003-07-21 18:55 Barry Lind <blind@xythos.com>
parent: Raymond Chui <raymond.chui@noaa.gov>
0 siblings, 0 replies; 6+ messages in thread
From: Barry Lind @ 2003-07-21 18:55 UTC (permalink / raw)
To: Raymond Chui <raymond.chui@noaa.gov>; +Cc: pgsql-jdbc@postgresql.org
Raymond,
Upgrade to the latest stable driver. You can download it from
jdbc.postgresql.org.
--Barry
Raymond Chui wrote:
> I am use PostgreSQL 7.2.1 in Redhat Linux 7.2
> Java 1.4.x
>
> When I do JDBC
>
> String sql = "SELECT datetime_column FROM mytable";
> ....
>
> Timestamp ts = resultSet.getTimestamp(2);
>
> If the timestamp return format like
>
> 2003-07-15 13:20:00.20+00
>
> then is OK. But if timestamp return like
>
> 2003-07-15 13:20:00.421+00
>
> Then I got SQLException
>
> Bad Timestamp Format at 23 in 2003-07-14 14:45:00.421+00
>
> What is 23?
> How do I resolve this problem?
>
> Thank Q!
>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2003-07-21 18:55 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-10 18:52 Timestamp problem Bernie Huang <bernie.huang@ec.gc.ca>
2000-07-10 19:07 ` Ed Loehr <eloehr@austin.rr.com>
2002-06-11 20:40 Timestamp problem kumar <kumar@cc.usu.edu>
2002-06-12 14:57 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2003-07-15 19:15 Timestamp problem Raymond Chui <raymond.chui@noaa.gov>
2003-07-21 18:55 ` Barry Lind <blind@xythos.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox