GetDayOfYear JulianCalendar System.globalization producing wrong julian date???

J

jason

DOTNET 2.0 VS 2005.

My client is saying August 13,2006.. julian date should equal 225.


Here's what I'm doing:

<%@ Import Namespace="system.globalization" %>

<script language="VB" runat="server">
Sub page_load()
Dim dtt As Date
dtt = DateTime.Now
rr = ffff.GetDayOfYear(dtt)
Response.Write(rr)
</script>

This is resulting in 212

What am I doing wrong?
 
J

jason

SORRY REPOST.. MISSED SOME CODE.

DOTNET 2.0 VS 2005.

My client is saying August 13,2006.. julian date should equal 225.


Here's what I'm doing:

<%@ Import Namespace="system.globalization" %>

<script language="VB" runat="server">
Sub page_load()
Dim ffff As New JulianCalendar()
Dim rr As Integer
Dim dtt As Date
dtt = DateTime.Now
rr = ffff.GetDayOfYear(dtt)
Response.Write(rr)
</script>

This is resulting in 212

What am I doing wrong?
 
J

Juan T. Llibre

August 13, 2006 at midnight = Julian 2453960.5
August 13, 2006 at noon = Julian 2453961

http://www.onlineconversion.com/julian_date.htm

Julian doesn't equate to "day of year".
If you mean "which day of the year is Aug. 13, 2006", it's 225.

To get the correct Day of Year, try this :

DayofYear.aspx:
-----------------
<%@ Page Language="VB" EnableViewState="false" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Threading" %>
<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim enUSCulture as CultureInfo = new CultureInfo("en-US")
Thread.CurrentThread.CurrentCulture = enUSCulture
Dim myDT = DateTime.Now
Dim myCal As System.Globalization.Calendar = CultureInfo.InvariantCulture.Calendar
lblMessage.Text = "Today is the day number " & myCal.GetDayOfYear(myDT) & " of this year."
End Sub
</script>
<html>
<head>
<title>Get Day of Year</title>
</head>
<body>
<asp:Label id="lblMessage" runat="server"/></asp:Label> <br />
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top