Results 1 to 8 of 8

Thread: Julian Dates (not Dicks)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    South Africa
    Posts
    113

    Question Julian Dates (not Dicks)

    In VB, is there a command that will give you the Julian date? i.e. the 320th day in the year, or is there a way that I can create the Julian date from other functions?
    Thanks
    You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    You might find that DateDiff gives you what you want.
    Get the difference in days between Now and the start of the year.

  3. #3
    Hyperactive Member vbud's Avatar
    Join Date
    Jan 2002
    Location
    Mru 20 17S, 57 33E Goal: Get out of the BOX Status: In The Shadows!!! Target Posts: 3,000,000,000
    Posts
    378

    Cool

    try

    VB Code:
    1. Dim JulianDate as Long
    2.  
    3. JulianDate = (Date - DateSerial(Year(Date), 1, 1)) + 1
    >!v!<
    Free your mind, stop thinking
    http://inspirone.blogspot.com

    Please rate this post if it helped you

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    See if this works for you

    VB Code:
    1. Private Sub ConvertDateToJulian(MyDate As String)
    2. Dim JYear As Integer
    3. Dim JDate As String
    4. JYear = Right(MyDate, 1)
    5. JDate = Right(MyDate, 1) + Format(DateDiff("y", "01-Jan-" & JYear, MyDate) + 1, "0##")
    6. MsgBox JDate
    7. End Sub
    8.  
    9. Private Sub Command1_Click()
    10. ConvertDateToJulian Text1.Text
    11. End Sub

  5. #5
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573
    Check http://www.nr.com/julian.html and download the page. Then you can open the document in a text editor and browse through the javascript code that you can convert to vb if it suits you.

  6. #6
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253
    It's not highly polished (or either finished) but the Julian/Gregorian stuff works . . .
    Attached Files Attached Files

  7. #7
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384
    Try this:
    Code:
        firstOfYear = "01/01/" & Year(Now)
        noOfDays = DateDiff("d", firstOfYear, Date + 1)
    Mel

  8. #8
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253
    ...

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