Results 1 to 8 of 8

Thread: Julian Date

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Posts
    4

    Julian Date

    I know there is a Julian Date function in Vb.Net but I don't know how to use it I'm new to VB.Net. I want to get the Julian Date of the given system date.

    e.g. vDate = #4/15/2005#
    m = JulianDate(vdate)
    Result: 2005105

    Could anybody help me how to do this? In VB6 to get the number of Days in a year I use format function (format(date,"Y")) but don't know in VB.Net

    Thanks,
    Jbats

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Julian Date

    I'm not sure how to answer your q exactly, but if you want to just format a dateTime object (ie, NOW) then do something like this:
    DateTime.Now.ToString("d")
    for a list of strings you can use to format dates look up here Date and Time Format Strings (click on Standard DateTime Format Strings on the left hand side)
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Julian Date

    I dunno what the julian calender really is but there is a class for it
    System.Globalization.JulianCalendar
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    Addicted Member Zero2Cool's Avatar
    Join Date
    Aug 2006
    Location
    Green Bay, WI
    Posts
    203

    Re: Julian Date

    vb.Net Code:
    1. Private Function JulianToStandard(ByVal vDate As String) As Long
    2.  
    3.         JulianToStandard= CLng(Format(Year(vDate), "0000") + Format(DateDiff("d", CDate("01/01/" + Format(Year(vDate), "0000")), vDate) + 1, "000"))
    4.  
    5. End Function

    Old thread, but I was trying to figure it out myself and noticed this one might not have been completely answered.

    Found code snippet from
    http://www.freevbcode.com/ShowCode.asp?ID=5669

  5. #5
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Julian Date

    Couldn't you simply re-arrange things?

    Code:
    Function GetJulianDate (ByVal TheDate As DateTime) As String
      Return TheDate.Year.ToString & TheDate.Month.ToString & TheDate.Day.ToString
    End Function
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  6. #6
    Fanatic Member Clanguage's Avatar
    Join Date
    Jan 2008
    Location
    North Carolina
    Posts
    659

    Re: Julian Date

    Here is the MSDN link to the Julian Date formating and calculations
    http://support.microsoft.com/kb/116281

    Hope this helps
    CLanguage;
    IF Post = HelpFull Then
    RateMe
    Else
    Say("Shut UP")
    End If
    DotNet rocks
    VB 6, VB.Net 2003, 2005, 2008, 2010, SQL 2005, WM 5.0,ahem ?OpenRoad?

  7. #7
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Julian Date

    from MSDN

    "The date January 1, 2001 A.D. in the Gregorian calendar is equivalent to the 19th day of December in the year 2000 A.D. in the Julian calendar.

    Currently, the JulianCalendar is not used by any of the cultures supported by the CultureInfo class. Therefore, the JulianCalendar class can be used only to calculate dates in the Julian calendar."


    The following has formulas:

    http://scienceworld.wolfram.com/astr...ulianDate.html
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  8. #8
    Addicted Member Zero2Cool's Avatar
    Join Date
    Aug 2006
    Location
    Green Bay, WI
    Posts
    203

    Re: Julian Date

    Quote Originally Posted by JuggaloBrotha
    Couldn't you simply re-arrange things?

    Code:
    Function GetJulianDate (ByVal TheDate As DateTime) As String
      Return TheDate.Year.ToString & TheDate.Month.ToString & TheDate.Day.ToString
    End Function
    Probably.
    I needed to take a standard date (01/01/2008) and convert to julian date (001) and the function I posted worked well.
    Last edited by Zero2Cool; Apr 2nd, 2008 at 07:05 AM.

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