How to find the day of the year (Full Version)

All Forums >> [Web Development] >> ASP, PHP, and Database



Message


dzirkelb1 -> How to find the day of the year (6/18/2009 9:07:06)

I am looking to find the day of the year, like 2/1/2009 would return 32. I am trying to do a date diff to figure this out, but am not coming up with reasonable results...here is what I have:

intDayOfYear = DateDiff("d", 12/31/2009, Date())

and it is returning 39982, which obviously isnt' correct for what I am looking for.

Can someone help me fix this or offer an easier way to figure out what day of the year today's date is?




ou812 -> RE: How to find the day of the year (6/18/2009 9:34:20)

Datediff looks like it is getting confused with no quotes around the date, and you're using a future date.Try this instead:
DateDiff("d","1/1/2009",date)




dzirkelb1 -> RE: How to find the day of the year (6/18/2009 10:56:36)

that worked, thanks :)




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875