Connecting Tech Pros Worldwide Forums | Help | Site Map

Acess Date Code (Julian Date)

IsdWeb
Guest
 
Posts: n/a
#1: Feb 5 '07
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]


chris.nebinger@gmail.com
Guest
 
Posts: n/a
#2: Feb 5 '07

re: Acess Date Code (Julian Date)


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:
Quote:
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]

IsdWeb
Guest
 
Posts: n/a
#3: Feb 5 '07

re: Acess Date Code (Julian Date)


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! =)

Gord
Guest
 
Posts: n/a
#4: Feb 6 '07

re: Acess Date Code (Julian Date)


On Feb 5, 5:37 pm, "IsdWeb" <rhayw...@isdweb.comwrote:
Quote:
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

chris.nebinger@gmail.com
Guest
 
Posts: n/a
#5: Feb 6 '07

re: Acess Date Code (Julian Date)


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:
Quote:
On Feb 5, 5:37 pm, "IsdWeb" <rhayw...@isdweb.comwrote:
>
Quote:
Hi, Wow thats it?
>
Quote:
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

Closed Thread