472,135 Members | 1,248 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,135 software developers and data experts.

Acess Date Code (Julian Date)

Hello,

I am a newbie to coding and need some help. I am trying to figure out
why the following code is not producing the correct Julian date. Any
suggestions? Also, I am trying to understand the syntax liek what
does DateAdd mean? If anyone can offer some good tutorials it would
be appreciated as well.

Thanks in advance.

Here is the code:

Format((DateAdd("d",-1,DateAdd("yyyy",
5,DateSerial(Year(Now()),Month(Now())+1,1))))-
DateSerial(Year(DateAdd("d",-1,DateAdd("yyyy",
5,DateSerial(Year(Now()),Month(Now())+1,1))))-1,12,31),"000") AS
[Julian Date]

Feb 5 '07 #1
4 14560
I'm not even trying to figure out your dateserial stuff. Rather, you
can use: format(date,"y") to get the proper Julian Date. Today is
36, btw.

As far as DateAdd, i think the help pretty much says it all. There
are different ways to increase/decrease a given date.

DateAdd (Interval, Number, Date)

Interval can be:
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second

Number is items to add/subtract (you can subtract with a - number)
Date is the date to start with.

So, DateAdd("yyyy",1, Date()) will give you Feb 5, 2008.

Note, if you want to add days, you can also just add a number:
Date()+1 will give you Feb 6, 2007.
Date()-1 will give you Feb 4, 2007.
Chris Nebinger.
On Feb 5, 11:44 am, "IsdWeb" <rhayw...@isdweb.comwrote:
Hello,

I am a newbie to coding and need some help. I am trying to figure out
why the following code is not producing the correct Julian date. Any
suggestions? Also, I am trying to understand the syntax liek what
does DateAdd mean? If anyone can offer some good tutorials it would
be appreciated as well.

Thanks in advance.

Here is the code:

Format((DateAdd("d",-1,DateAdd("yyyy",
5,DateSerial(Year(Now()),Month(Now())+1,1))))-
DateSerial(Year(DateAdd("d",-1,DateAdd("yyyy",
5,DateSerial(Year(Now()),Month(Now())+1,1))))-1,12,31),"000") AS
[Julian Date]

Feb 5 '07 #2
Hi, Wow thats it?

How does the way know how to do this in the statment format(date,"y")?

Thanks a lot for your help, much appreciated! =)

Feb 5 '07 #3
On Feb 5, 5:37 pm, "IsdWeb" <rhayw...@isdweb.comwrote:
Hi, Wow thats it?

How does the way know how to do this in the statment format(date,"y")?
The VBA help file says that Format([date], "y") will...

"Display the day of the year as a number (1 - 366)."

So, if that's what you want then yes "that's it", except that it is
not a "Julian date". It is an "ordinal date", ref:

http://en.wikipedia.org/wiki/ISO_8601#Ordinal_dates

Feb 6 '07 #4
My experience with Julian Dates is the date of the year (at least
according to my time in the USAF).

If that's what you need, then save the date in a field. Then, in a
query, use this:

JulianDate:FOrmat([DateField],"y")

But, according to Wikipedia:

The term Julian date is also used to refer to:

Julian calendar dates
ordinal dates (day-of-year)
The use of Julian date to refer to the day-of-year (ordinal date) is
usually considered to be incorrect.
Which do you want?
Chris Nebinger
On Feb 6, 6:25 am, "Gord" <g...@kingston.netwrote:
On Feb 5, 5:37 pm, "IsdWeb" <rhayw...@isdweb.comwrote:
Hi, Wow thats it?
How does the way know how to do this in the statment format(date,"y")?

The VBA help file says that Format([date], "y") will...

"Display the day of the year as a number (1 - 366)."

So, if that's what you want then yes "that's it", except that it is
not a "Julian date". It is an "ordinal date", ref:

http://en.wikipedia.org/wiki/ISO_8601#Ordinal_dates

Feb 6 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Mick White | last post: by
5 posts views Thread by Dennis M. Marks | last post: by
30 posts views Thread by Dr John Stockton | last post: by
9 posts views Thread by Reggie | last post: by
3 posts views Thread by Chris Davoli | last post: by
29 posts views Thread by james | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.