Results 1 to 5 of 5

Thread: Julian Dates

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    2
    Has anyone worked out a way to determine the Julian date for any given day. Julian date is the year + day Ie Jan 1 =0001 and Dec 31 = 0365 (for this year). I need to be able to enter a given date and determine the Julian date to be used create a unique serial number.


  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    I'm not sure what you mean - if you just need to know the number of days since the beginning of the year you could use;

    Code:
    Dim ThisYear As Integer
    Dim ThisDate As Date
    Dim JulianDate As Integer
    
    ThisDate=Cdate("22/06/2000")
    
    ThisYear=Year(ThisDate)
    JulianDate=DateDiff("d",CDate("01/01/"+Cstr(ThisYear)),ThisDate)
    MsgBox JulianDate
    This will display the number of days from the start of the year to the date you place in ThisDate.
    If this isn't what you meant please let me know..

    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  3. #3
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    This one works

    Code:
        Dim StrDate As String
        Dim dtDate As Date
            
        dtDate = Now
        
        'get the last disgit of the year.
        StrDate = Mid$(Format$(dtDate, "YYYY"), 4, 1)
        'get the day of the year
        StrDate = StrDate & Format(dtDate, "y")
        MsgBox StrDate
    Hope it helps.
    Iain, thats with an i by the way!

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    2

    Smile

    My thanks to you both. I am new at this and my first idea was far more convoluted. You both were very helpful.

    Thanks
    Doug

  5. #5
    Hyperactive Member Steve Stunning's Avatar
    Join Date
    Jul 1999
    Location
    Fairfax, Virginia
    Posts
    314
    Iain17


    Thanks.. LOL I just did a search for this info. It was a great help.
    Steve Stunning

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width