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

  • Thread starter Thread starter jason
  • Start date Start 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?
 
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?
 
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>
------------

See it running at : http://asp.net.do/test/dayofyear.aspx


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
 
Back
Top