Thread: Day of year
View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Day of year

So what you're saying is that the 60th day of any year doesn't always occur in
the same month.

That's a good reason to include the year:
=YEAR(TODAY())&"-"&TEXT(TODAY()-DATE(YEAR(TODAY()),1,0),"000")

(And I like 4 digit years!)




JLatham wrote:

Probably one of those "don't pay any attention to me today - I DID take my
meds!" days - been on pain killers for 2 days now. But March 1, 2007 is
Julian day 60 (31 in Jan, 28 in feb 59 + 1 = 60) But in Leap Years, March 1
is Julian day 61 (31+29+1) So you have to be talking about the same year if
you use TODAY for a comparison - if you happened to be speaking of a day in a
leap year but used a non-leap year to calculate Julian date, then the day
would be off by 1 if the date was after Feb 28 of that year.

"Dave Peterson" wrote:

Huh?
<bg



JLatham wrote:

Yes, as long as both dates are in same year, but if one date was after Feb 29
of a leap year and other year is not leap year...

"MartinW" wrote:

And following that
=TODAY()-DATE(YEAR(TODAY()),1,0)
Should work in any year.

HTH
Martin




--

Dave Peterson


--

Dave Peterson