pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: datediff?
2+ messages / 1 participants
[nested] [flat]
* Re: datediff?
@ 2002-10-27 18:23 Josh Berkus <josh@agliodbs.com>
0 siblings, 0 replies; 2+ messages in thread
From: Josh Berkus @ 2002-10-27 18:23 UTC (permalink / raw)
To: Erwin Moller <erwin@dexus.nl>; +Cc: pgsql-sql
Erwin,
> I read your FAQ: Working with Dates and Times in PostgreSQL with
> interest
> and was wondering if somebody came up with those datediff and dateadd
> functions?
> I couldn't find any at techdocs.postgresql.org.
I know somebody worked on one. I take it you read the articles on SQL
Server ---> PostgreSQL conversion?
The problem, as I recall, was one of quoted identifiers. That is, for
datediff, you do:
DATEDIFF ( m, date1, date2 )
whereas a postgresql function would have to say
DATEDIFF ( 'm', date1, date2 )
I don't know if anyone ever worked out a way around this minor problem.
-Josh
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: datediff?
@ 2002-10-27 19:49 Josh Berkus <josh@agliodbs.com>
0 siblings, 0 replies; 2+ messages in thread
From: Josh Berkus @ 2002-10-27 19:49 UTC (permalink / raw)
To: Erwin Moller <erwin@dexus.nl>; +Cc: pgsql-sql
Erwin,
> Thanks for your quick response Josh.
>
> I wasn't aware of the Postgresql-function DATEDIFF()
> The accolade ' is not a problem of course!
Whoops! Didn't want to confuse you. What I meant was, a PgSQL
function "Datediff" could be easily *written*, except that it would
need quoted identifiers, different from the T-SQL function. If anyone
on this list has written a DateDiff, please post!
> But I have to say to my shame, I was asking you too soon, because all
> I
> really needed was a function that could return me some absolute
> timediff,
> and I found date_part('epoch', date) does the trick nicely enough for
> me.
> I can now take the diff in millisecs since start of epoch, which is
> enough
> to do all other calculations easily.
Cool! Glad that you found something that would work for you.
-Josh
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-10-27 19:49 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-10-27 18:23 Re: datediff? Josh Berkus <josh@agliodbs.com>
2002-10-27 19:49 Re: datediff? Josh Berkus <josh@agliodbs.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