By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,500 Members | 2,520 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,500 IT Pros & Developers. It's quick & easy.

Acess Date Code (Julian Date)

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.