pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to compare dates?
4+ messages / 4 participants
[nested] [flat]
* How to compare dates?
@ 2003-03-17 08:29 Abdul Wahab Dahalan <wahab@mimos.my>
2003-03-17 08:45 ` Re: How to compare dates? Victor Yegorov <viy@pirmabanka.lv>
2003-03-17 14:41 ` Re: How to compare dates? Achilleus Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 2 replies; 4+ messages in thread
From: Abdul Wahab Dahalan @ 2003-03-17 08:29 UTC (permalink / raw)
To: pgsql-sql
How do I compare this dates:
1. date( in timestamp) = 2003-03-16 11:29:23.567417+08
2. date created from java program like :
String format ="dd.MM.yyyy";
Date today = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(format);
String todaysdate = formatter.format(today);
says the result is : todaysday = 17.03.2003
Any help very much appriciated
Thanks.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to compare dates?
2003-03-17 08:29 How to compare dates? Abdul Wahab Dahalan <wahab@mimos.my>
@ 2003-03-17 08:45 ` Victor Yegorov <viy@pirmabanka.lv>
1 sibling, 0 replies; 4+ messages in thread
From: Victor Yegorov @ 2003-03-17 08:45 UTC (permalink / raw)
To: pgsql-sql
* Abdul Wahab Dahalan <wahab@mimos.my> [17.03.2003 10:36]:
> How do I compare this dates:
>
> 1. date( in timestamp) = 2003-03-16 11:29:23.567417+08
>
> 2. date created from java program like :
>
> String format ="dd.MM.yyyy";
> Date today = new Date();
> SimpleDateFormat formatter = new SimpleDateFormat(format);
> String todaysdate = formatter.format(today);
>
> says the result is : todaysday = 17.03.2003
>
> Any help very much appriciated
> Thanks.
use to_date and to_char functions, refer to para 6.7 of PostgreSQL User's
Guide.
--
Victor Yegorov
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to compare dates?
2003-03-17 08:29 How to compare dates? Abdul Wahab Dahalan <wahab@mimos.my>
@ 2003-03-17 14:41 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
1 sibling, 0 replies; 4+ messages in thread
From: Achilleus Mantzios @ 2003-03-17 14:41 UTC (permalink / raw)
To: Abdul Wahab Dahalan <wahab@mimos.my>; +Cc: pgsql-sql
On Mon, 17 Mar 2003, Abdul Wahab Dahalan wrote:
> How do I compare this dates:
>
> 1. date( in timestamp) = 2003-03-16 11:29:23.567417+08
>
> 2. date created from java program like :
>
> String format ="dd.MM.yyyy";
> Date today = new Date();
> SimpleDateFormat formatter = new SimpleDateFormat(format);
> String todaysdate = formatter.format(today);
>
> says the result is : todaysday = 17.03.2003
If you need to compare pgsql timestamp (unix time + micros)
with java.util.Date (unix time), then
you only need the compare() method.
Note that java.sql.Timestamp extends java.util.Date.
>
> Any help very much appriciated
> Thanks.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
--
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel: +30-210-8981112
fax: +30-210-8981877
email: achill@matrix.gatewaynet.com
mantzios@softlab.ece.ntua.gr
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: How to compare dates?
@ 2003-03-17 08:58 Christoph Haller <ch@rodos.fzk.de>
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Haller @ 2003-03-17 08:58 UTC (permalink / raw)
To: pgsql-sql; +Cc: wahab@mimos.my
>
> How do I compare this dates:
>
> 1. date( in timestamp) = 2003-03-16 11:29:23.567417+08
>
> 2. date created from java program like :
>
> String format ="dd.MM.yyyy";
> Date today = new Date();
> SimpleDateFormat formatter = new SimpleDateFormat(format);
> String todaysdate = formatter.format(today);
>
> says the result is : todaysday = 17.03.2003
>
select to_char(timestamp '2003-03-16 11:29:23.567417+08','DD.MM.YYYY');
to_char
------------
16.03.2003
(1 row)
if that is what you wanted to know.
Regards, Christoph
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2003-03-17 14:41 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-03-17 08:29 How to compare dates? Abdul Wahab Dahalan <wahab@mimos.my>
2003-03-17 08:45 ` Victor Yegorov <viy@pirmabanka.lv>
2003-03-17 14:41 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2003-03-17 08:58 Re: How to compare dates? Christoph Haller <ch@rodos.fzk.de>
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