How to convert Julian date into Calendar date (VB.Net)

Hi all,


I have some dates which are in Julian format and I need to convert them into calendar dates

 for example if the Julian date is 1, I need to be able to convert it into 1/1/2007, If the julian date is 66 then I would need to convert it to 3/7/2007 and so on.


Every year would start with 1 and end with 365

365 = 12/31/2007.


Is there a function or tutorial somewhere ?


thanks for any help. 


3/7/2007 3:50:17 PM 91979 articles. 4 followers. Follow

5 Replies

Similar Articles

[PageSpeed] 4

1) Your dates aren't in Julian format!!

2) How do you know which year you are referring to?

3) Have you tried the AddDays function of the Date/DateTime class?

3/7/2007 4:32:40 PM

Hello James,

Yes, they are in Julian format.  They correspond to the Settlement Date field in every ACH Batch Header Record according to NACHA.   You can refer to the ACH Rules Guide for further details if you have doubts. 

For question #2: I do not need to know to which year they refer.  For that there are other fields which provide that info.

 And yes I have used the AddDate function, but haven’t found a way to make it work for this conversion.


Thanks anyways for your suggestions.


3/7/2007 5:22:55 PM

OK... I see where you are getting your reference from, however, these are not really Julian dates... they are ordinal dates!!!

See and

Anyway... given this, I can't see how you can't use DateAdd!! What's wrong with this??!!

' you know the year
Dim iYear As Integer = 2007
' here's your "julian" date
Dim iDays As Integer = 66
' here's how you turn it into a real date!!
Dim dt As Date = (New Date(iYear, 1, 1)).AddDays(iDays - 1)

3/7/2007 6:27:33 PM

Thanks a lot for your help James.

This is how it finally worked.  the same method you suggested me.


 Imports System.Globalization


             Dim StartingDate As Date = "12/31/" + Format(DateAdd(DateInterval.Year, -1, Now), "yy")
            Dim Julian_SettDate As Double = SettlementDate
            Dim Greg_SettDate As String
            Greg_SettDate = DateAdd(DateInterval.Day, Julian_SettDate, StartingDate)

3/7/2007 6:47:59 PM

You need to be careful with what you're doing though as it will not necessarily work on other localized versions of Windows...

Here in the UK the date format is dd/mm/yyyy and what you've got could fail because of that...

The method I've suggested works regardless of localization issues!!!

If this has been of helped, please mark the thread as answered.



3/7/2007 11:59:02 PM

Similar Artilces:

converting to from offered me some sample code when I signed up with them the only problem is the sample code is in but my page that they type all of their credit card into is <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage(""); } private String readHtmlPage(string url) { ...

calendar date span (date start : date end)
Hi! Can anyone help me with this? Say, I have these two textboxes. Date Start:        Date End:             What I wanted to do is to put dates on it using the calendar. My problem is I do not know what to do to keep the "Date Start" not way after the set "Date End", and for "Date End" not way before the set "Date Start".   example: Date Start: July 1, 2008              &nb...

Get AD Date with VB.Net
I have tried getting a date from AD with this post,, to no avail.I only have VB.Net to convert the date.  I am also using the DirectoryEntry/System_ComObject.  In his post he gives a C# example that cannot be converted to VB.Net because it doesn't support byte shifting and UIntegers (I think).  Thanks in advance,If an answer has been provided to you question please mark it as an answer. I solved it.  I just wrapped the following C# code in a C# Library. using System;using System.DirectoryServices;using System.Reflection;namesp...

Dates, Dates, Dates!
Hello all... I am in the process of building an appointment system, and I am trying to see if I can get some pointers on which way to go on this. The first version of this appointment system was very lo-tech, and it stored all of the possible dates/times in the database. Once a user booked an appointment, their information was logged to that date/time, and then that date/time would no longer show in the list of possible openings. This was great for a temporary fix, but with having to pre-populate all of the dates/times, the system would eventually have to be updated to continue on pa...

used a to converter and am now getting a syntax error.
ok I used a cool utility at to convert some to and it spit out a bunch of code which almost works but I am getting a syntax error on this line Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) I tried it that way and also like Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) but either way gave the same error Compiler Error Message: BC30035: Syntax error. Source Error: Line 26: Line ...

Sending SMS using or using or
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

converting 2003 files to 2005
Hi, i am beginner..i watch videos about made on 2003 when i wrote these codes in 2005 ,it gives there any program which convert the code automatically?   thanks,Thanks,Speranza What videos are you talking about?  There are lots of great, up-to-date ASP.NET Videos on this site for free.Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you! i am talking about videos..Thanks,Speranza Speranza:they made on 2003 when i wrote these codes in 2005 ,it gives there a...

date picker for calendar in onto textbox using VB.NET
can anyone guide me how i can implement a calendar date picker.. when the user click on the calendar, the date will appear in the textbox.. i need it in VB.NET language..tks!   mirainc:can anyone guide me how i can implement a calendar date picker.. when the user click on the calendar, the date will appear in the textbox.. i need it in VB.NET language..tks! Hi,You can use the ASPNET Calendar control and on SelectionChanged event of Calendar you can simple write a snippet to display the selected date on the TextBox control.. see belowProtected Sub Calendar1_SelectionChanged(ByVal...

need a "Date Modified: <date>" control for vb 3.5
Sounds simple!  I just want a thing in my footer that says, "Date Modified: <date>" where <date> is the actual date the file was modified. I posted this question in the beginner's area but the suggested solutions do not work. I tried adding a Label control on my page, thus: <asp:Label ID="Label1" runat="server"></asp:Label>then in my masterpage.master.vb I have: Partial Class MasterPage    Inherits System.Web.UI.MasterPage    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System...

Converting Web Site from Vb.Net 2003 to Vb.Net 2005
I have a web site in 2003 that I what to convert to 2005. I open my web site in the visual studio 2005 by Local IIS option. I follow the steps of the visual studio conversion wizard.In the conversion report I received the following warning 'Referencepath' settings have not been converted.  Can anyone tell what I have to do to make this warning disappear? Best regards,Sérgio 'Referencepath'  is a property you can set with with VS2003 project file, sothat when ever you to do Add reference this path is serached for class libraries.  We do not  have that ...

Converting from to
Hello I have recently purchased VBGolds RawDataPrinter which should allow users to print directly to label printers on our network directly from a c# web form.  Unfortunately they only supply examples and I have need of c#.  The component has been installed on our web server.  This is some code that they have supplied as examples in   "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html xmlns="" >"Head1" runat="server&qu...

Converting a date field to Julian date
Is there a way to convert a datetime field in sybase to a julian date? I have search and search and have not come up with any answer. TIA Mike I don't know how IQ works... I use this "formula" to convert the current date to julian format: select substring(convert(varchar(20),getdate(),112),1,4)+'/'+convert(varchar(20),da tediff(dd,convert(datetime,substring(convert(varchar(20),getdate(),112),1,4) ),convert(varchar(20),getdate(),112))) ~Luis <mevasquez> wrote in message > Is there a way to convert ...

VB.Net convert "pwdlastset" to a normal date ?? Please Help !
Hi,got a big problem - i want to send mails to users who´s passwords expire.So i get all users from AD and the "pwdlastset" - property. This is a long integer including milliseconds. Now i have to change this large number to a normal date.I have lot of samples but no one is doing fine.All of these samples require a "object.highpart" and "object.lowpart" property - but VB.Net quit this with error.Isn´t there any easy way to convert this ?(sorry for bad english :-)) cashi:Hi,got a big problem - i want to send mails to users who´s passwords expire.So i get all users from AD and the "pwd...

convert julian date to gregorian date
Did anybody can tell me if there exist function or code to convert julian date to gregorian and greorian date to julian date. Thank you very much excuse my english i am french canadian There are a couple of functions in the n_cst_datetime object in PFC that do that. If you don't want to use PFC, at least look at the code to see what they are doing. On Thu, 15 Feb 2001 12:04:55 -0500, in powersoft.public.powerbuilder.general cynthia ayotte <> wrote: >Did anybody can tell me if there exist function or code to convert >julian date ...