从约会开始获得朱利安日 [英] Obtaining the Julian Day from a date

查看:101
本文介绍了从约会开始获得朱利安日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




从postgresql

日期获得Julian日的最佳方法是什么?


PostgreSQL 7.3.4 on i386-redhat-linux-gnu,由GCC编译

i386-redhat-linux-gcc(GCC)3.2.2 20030222(Red Hat Linux 3.2.2- 5)


我正在做一些日期算术,间隔1天,并且想要

,例如,转到偶数朱利安日。我想

我总是可以从朱利安日零点开始间隔

再除以一天中的秒数,但是那个

听起来既残酷又可能不准确,因为飞跃

秒等等。


有人提到能够在列表档案中执行此操作,

但没有人说出它是如何实际完成的。


谢谢。


Karl< ko * @meme.com>

自由软件:你没有还钱,你支付前进。

- Robert A. Heinlein


---------------------------(广播结束)---------- -----------------

提示6:您是否搜索了我们的列表档案?

http://archives.postgresql.org

Hi,

What''s the best way to obtain the Julian day from a postgresql
date?

PostgreSQL 7.3.4 on i386-redhat-linux-gnu, compiled by GCC
i386-redhat-linux-gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

I''m doing some date arithmetic with 1 day intervals and want
to, for example, round to the even Julian day. I suppose
I could always take the interval from julian day zero
and then divide by the number of seconds in a day, but that
sounds both brutal and potentially inaccurate due to leap
seconds and so forth.

There''s mention of being able to do this in the list archives,
but nobody says how it''s actually done.

Thanks.

Karl <ko*@meme.com>
Free Software: "You don''t pay back, you pay forward."
-- Robert A. Heinlein

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

推荐答案

Karl O. Pinc写道:
Karl O. Pinc wrote:
获取Juli的最佳途径是什么? postgresql
约会的一天?
What''s the best way to obtain the Julian day from a postgresql
date?




=>选择to_char(''1970年5月''::日期,''J'');

to_char

---------

2440724

--Phil。

------------------------ ---(广播结束)---------------------------

提示9:计划者将忽略如果您的

加入列的数据类型不匹配,您希望选择索引扫描



=> select to_char(''17 may 1970''::date,''J'');
to_char
---------
2440724
--Phil.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column''s datatypes do not match


On Sep,Sep 09 ,2004年12:35:14 -0500,

" Karl O. Pinc" < ko*@meme.com>写道:
On Thu, Sep 09, 2004 at 12:35:14 -0500,
"Karl O. Pinc" <ko*@meme.com> wrote:


什么是从postgresql日期获得Julian日的最佳方式?

PostgreSQL 7.3.4 on i386-redhat-linux-gnu,由GCC编译
i386-redhat-linux-gcc(GCC)3.2.2 20030222(Red Hat Linux 3.2.2-5)

>我正在做一些日期算术,间隔1天,并希望
,例如,圆到甚至朱利安日。我想
我总是可以从朱利安日零点开始间隔,然后除以一天中的秒数,但这听起来既残酷又可能因飞跃而不准确秒等等。

提到能够在列表档案中执行此操作,
但没有人说明它是如何实际完成的。
Hi,

What''s the best way to obtain the Julian day from a postgresql
date?

PostgreSQL 7.3.4 on i386-redhat-linux-gnu, compiled by GCC
i386-redhat-linux-gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

I''m doing some date arithmetic with 1 day intervals and want
to, for example, round to the even Julian day. I suppose
I could always take the interval from julian day zero
and then divide by the number of seconds in a day, but that
sounds both brutal and potentially inaccurate due to leap
seconds and so forth.

There''s mention of being able to do this in the list archives,
but nobody says how it''s actually done.




您可能有兴趣知道有些运算符组合了

日期和可能直接使用的整数类型而不是

转换为朱利安时代。


---------------------------(广播结束) - --------------------------

提示8:解释分析是你的朋友



You might be interested to know that there are operators that combine
date and integer types that might be usable directly instead of
converting to Julian days.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend




On 2004.09.09 14:11 Bruno Wolff III写道:

On 2004.09.09 14:11 Bruno Wolff III wrote:
2004年9月9日星期四12:35 :14 -0500,
Karl O. Pinc < ko*@meme.com>写道:
On Thu, Sep 09, 2004 at 12:35:14 -0500,
"Karl O. Pinc" <ko*@meme.com> wrote:


什么是从postgresql日期获得Julian日的最佳方式?

PostgreSQL 7.3.4 on i386-redhat-linux-gnu,由GCC编译
i386-redhat-linux-gcc(GCC)3.2.2 20030222(Red Hat Linux 3.2.2-5)

>我正在做一些日期算术,间隔1天,并希望
,例如,圆到甚至朱利安日。
Hi,

What''s the best way to obtain the Julian day from a postgresql
date?

PostgreSQL 7.3.4 on i386-redhat-linux-gnu, compiled by GCC
i386-redhat-linux-gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

I''m doing some date arithmetic with 1 day intervals and want
to, for example, round to the even Julian day.



您可能有兴趣知道这一点有些运算符组合了可能直接使用的日期和整数类型,而不是转换为Julian天。



You might be interested to know that there are operators that combine
date and integer types that might be usable directly instead of
converting to Julian days.




谢谢。 (它没有记录7.3但是有效。它记录了

为7.4。)


不幸的是模数(%)不能在日期运行我仍然需要


转换为朱利安日。 :-(我需要知道我在一个

的常规重复间隔内。大多数情况下,在我的情况下,modulo 2.

(我们随意决定开始我们的间隔时间Julian Day 0.)


Karl< ko*@meme.com>

自由软件:你不会还钱,你支付转发。

- Robert A. Heinlein


-------------------- -------(播出结束)---------------------------

提示6:您是否搜索过我们的列表档案?

http://archives.postgresql.org



Thanks. (It''s not documented for 7.3 but works. It is documented
for 7.4.)

Unfortunately modulo (%) does not operate on dates so I still need

to convert to Julian day. :-( I need to know where I am within a
regular repeating interval. Mostly, in my case, modulo 2.
(We arbitrarly decided to begin our interval on Julian Day 0.)

Karl <ko*@meme.com>
Free Software: "You don''t pay back, you pay forward."
-- Robert A. Heinlein

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


这篇关于从约会开始获得朱利安日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆