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

Re: [Clip] julian date

Expand Messages
  • RS
    Hi Michael, ... Since the pack contains three demos in addition to the function clip, and has several long lines in it that might be broken, I made it into a
    Message 1 of 5 , May 31 1:59 PM
    • 0 Attachment
      Hi Michael,

      At 03:07 PM 05/31/00 -0400, 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?
      >

      Since the pack contains three demos in addition to the function clip, and
      has several long lines in it that might be broken, I made it into a Library
      which you can download from:

      http://home.att.net/~ptools/main/clips/DayOfTheYear.clb

      I also included a clip to calculate the number of days between two dates,
      you might find useful.

      The formula also takes into account leap years, and can even work with
      dates BC.

      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.

      HTH.



      Regards,

      RS

      ======================================================

      ClipWriter 2.12 -- Millennium Edition

      http://home.att.net/~ptools/ClipWriter/cw.htm


      The easiest way to program NoteTab, and
      ...a powerful tool for Clip professionals!



      ======================================================







      ======================================================
    • Claes Gauffin
      Hi Michael, RS et al, ... This would be the clip mentioned by RS. At the time, we had a slightly academic discussion on how to compensate for leap year
      Message 2 of 5 , Jun 5, 2000
      • 0 Attachment
        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%
      • Bob Janes
        Claes wrote: 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
        Message 3 of 5 , Jun 5, 2000
        • 0 Attachment
          Claes wrote:
          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.

          Just reminds me that I worked with a client last year who used week numbers
          so I used the numbers shown in MS Outlook. Except they used the numbers from
          Lotus Notes which were just one week different. Caused no end of admin chaos
          until we bottomed out what was happening.

          Best wishes

          Bob

          --

          Bob Janes
          Webster & Janes Ltd
          PO Box 211 Welwyn AL6 0EX UK
          +44 (1438) 84-0206
          mailto:bob.janes@...
          www.webster-and-janes.co.uk
        • Charles M. Raine
          Hi Claes, Michael & RS: ... No, it certainly is not trivial. I have spent considerable time this morning thinking about such a clip. In my vocation before my
          Message 4 of 5 , Jun 5, 2000
          • 0 Attachment
            Hi Claes, Michael & RS:

            At 02:48 PM 6/5/2000 +0200, you wrote:

            >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.

            No, it certainly is not trivial. I have spent considerable time this
            morning thinking about such a clip. In my vocation before my retirement, I
            spent a lot of time programming, in the area of date calculations for
            financial transactions and am therefore very familiar with the problem.
            NoteTab complicates this to some extent in that it will only give you
            information for the Current date, (particularly the day of the week). As
            yet I have not come up with a simple calculation for Week of the Year, but
            give me some more time. I enjoy this kind of a challenge!

            Below is a modified version of your clip, which I 'personally' find easier
            and quicker to use than your version. One nice advantage to it is, that if
            you hit OK to the wizard, it automatically tells you the days for the
            current date. I had just finished using a similar Edit Mask in another clip
            which I just completed for something else. You will also notice that I am
            partial to using arrays, whenever possible.

            ---------< start clip >---------
            H="Day of Year"
            ; Charles M. Raine < rainec@... >
            ; 06/05/2000, 02:09:41 PM
            ^!Set %date%=^$GetDate(yyyy-mm-dd)$
            ^!Set %date%=^?{(M="0000-00-00;1;*")Modify Date as Required=^%date%}
            ^!SetArray %adate%=^$StrReplace("-";";";"^%date%";n;n)$
            ^!If "^%adate2%"<"10" Next ELSE Skip
            ^!Set %adate2%=^$StrReplace("0";"";"^%adate2%";n;n)$
            ^!Setarray %mdays%=0;31;59;90;120;151;181;212;243;273;304;334
            ^!If ^$Calc(^%adate1%mod4)$ <> 0 skip_1
            ^!If ^%adate2%>2 ^!Inc %adate3%
            ^!Set %dayofy%=^$Calc(^%mdays^%adate2%%+^%adate3%)$
            ^!Info Day of the year: ^%dayofy%
            ---------< end clip >-----------


            Charlie.

            Charles M. Raine Home Page: http://www.escape.ca/~rainec
            Phone (204) 895-0940 ICQ # 300058
            Winnipeg, Manitoba, Canada
          Your message has been successfully submitted and would be delivered to recipients shortly.