将公历日期转换为儒略日期(Access 2003) [英] Converting Gregorian date to Julian date (Access 2003)

查看:110
本文介绍了将公历日期转换为儒略日期(Access 2003)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有一个关于此的帖子,但我无法添加它;我刚加入。问题是我不想更改整个数据库输出的日期格式,只是为了报表上的标题和该报表上的字段。


我以为我可以进入表达式构建器并粘贴在线程中发布的关于此转换的代码之一 - 你知道这不起作用。


所以,我去了新模块并尝试在立即窗口中输入以下信息,但它没有用。


?对(年份(#1/20/2003#),1)&

格式(DateDiff(" d",#1/1/2003#,#1/20/2003#) + 1,000)

3020


我按照指示启用工具中的要求变量声明 Visual Basic编辑器的菜单,然后将以下内容复制到''程序窗口'':


功能:CDate2Julian()


目的:将日期转换为儒略日。该功能适用​​于基于Gregorian(现代)日历的日期。


ARGUMENTS:

MyDate:有效的Microsoft Access日期。


退货:作为字符串的三位数Julian日。


结束功能


但是,程序窗口中的整个类型变为红色字体颜色,并且在即时窗口中也是无效的...


底线,你们其中一个程序员可以确认不知道如何从查询字段中的表达式中获取Julian日期新报告将从中提取数据?


非常感谢Paul Davis

I know that there is a thread about this, but I was unable to add to it; I just joined. The problem is that I do not want to change the date format for the entire database output, merely for a header on a report and for a field on that report.

I thought that I could just go into the expression builder and paste one of the codes that were posted in the thread about this conversion-you''ll know that did not work.

So, I went to the new module and tried to enter the following information into the Immediate Window, but it did not work.

? Right(Year(#1/20/2003#),1) &
Format(DateDiff("d",#1/1/2003#,#1/20/2003#)+1,"000")
3020

I followed the direction to enable the ''Require Variable Declaration'' in the ''Tools'' menu of the Visual Basic Editor and then copied the following into the ''Procedure Window'':

FUNCTION: CDate2Julian()

PURPOSE: Convert a date to a Julian day. The function works with dates based on the Gregorian (modern) calendar.

ARGUMENTS:
MyDate: A valid Microsoft Access date.

RETURNS: A three digit Julian day as a string.

End function

However, the entire type in the procedure window changes to red font color and it is invalid in the immediate window as well...

Bottom line, can one of you programmers confirm that it is not known how to get the Julian date from a ''Expression'' in a field of a query that this new Report will draw data from?

Thanks much, Paul Davis

推荐答案




我工作过这是一段时间以前,但暂时没有看过它
Hi

I worked on this a some time ago, but haven''t looked at it in a while
展开 | 选择 | Wrap | 行号


Paul



其他一些建议: -
Paul


A couple of other suggestions:-
展开 | 选择 | Wrap | 行号


我''我不确定Julian版本究竟是什么,但是年份中的日期可以通过以下方式获得:
I''m not sure what the Julian version is exactly, but the day in year number can be got by :
展开 | 选择 | Wrap | 行号


这篇关于将公历日期转换为儒略日期(Access 2003)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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