Acess Date Code (Julian Date)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • IsdWeb

    #1

    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(Ye ar(Now()),Month (Now())+1,1))))-
    DateSerial(Year (DateAdd("d",-1,DateAdd("yyyy ",
    5,DateSerial(Ye ar(Now()),Month (Now())+1,1))))-1,12,31),"000") AS
    [Julian Date]

  • chris.nebinger@gmail.com

    #2
    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...@isdwe b.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(Ye ar(Now()),Month (Now())+1,1))))-
    DateSerial(Year (DateAdd("d",-1,DateAdd("yyyy ",
    5,DateSerial(Ye ar(Now()),Month (Now())+1,1))))-1,12,31),"000") AS
    [Julian Date]

    Comment

    • IsdWeb

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

      Comment

      • Gord

        #4
        Re: Acess Date Code (Julian Date)

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



        Comment

        • chris.nebinger@gmail.com

          #5
          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:FOrm at([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...@isdwe b.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

          Comment

          Working...