Loading ...
Sorry, an error occurred while loading the content.

3857Re: [Clip] julian date

Expand Messages
  • Claes Gauffin
    Jun 5, 2000
      Hi Michael, RS et al,

      At 15:59 2000-05-31 -0500, you wrote:
      >>I would like to return the julian date with a clip
      >>It consists of seven characters
      >>the year and then three digits which are 'day of year'
      >>for example, today is 2000152
      >>if january lasted the entire year, this would be January 152, 2000
      >>
      >>at any rate, anyone know how to get the 152 from existing date functions
      >>with some calculating?
      >
      >There was an interesting clip by Claes Gauffin and Eb Guenther, some time
      >ago on the List, which used a different approach to get the day of the year.
      >

      This would be the clip mentioned by RS.
      At the time, we had a slightly academic discussion on how to compensate for
      leap year deviation in the year 2100, 2200,... I think we might quietly
      skip that.

      In fact, I have been thinking to use this to create week numbers. I don't
      know if this bureaucratic abomination is something that you too suffer from
      in other countries. Most of our large scale time planning is based on the
      week number concept. Since it is a totally synthetic concept, I always have
      to check in my calender whatever is meant by "Week 34". Thus I would like a
      clip to tell me what week YYYY-MM-DD is, and vice versa.
      The week number is in Sweden defined like this:
      - All weeks start on Mondays.
      - Week number 1 is the first week with 4 or more days in the new year.
      I don't think it is too difficult to make a clip for this, but it is not
      trivial.

      Regards /Claes

      H="Day of year"
      ; Looong line follows
      ^!set
      %year%=^?{Year=^$getdate(yy)$};%month%=^?{Month=1|2|3|4|5|6|7|8|9|10|11|12};
      %day%=^?{Day=1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|
      25|26|27|28|29|30|31}
      ;Long line end
      ^!Setarray %mdays%=0;31;59;90;120;151;181;212;243;273;304;334
      ^!if ^$Calc(^%year%mod4)$ <> 0 skip_1
      ^!Setarray %mdays%=0;31;60;91;121;152;182;213;244;274;305;335
      ^!Set %dayofy%=^$Calc(^%mdays^%month%%+^%day%)$
      ^!Info Day of the year: ^%dayofy%
    • Show all 5 messages in this topic