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

Re: [Clip] Juggling the date

Expand Messages
  • Axel Berger
    ... ^!If ^$GetSelSize$ 3 SKIP ^!Select ALL ^!Replace b( d{2})/( d{2})/( d{4}) b $3$2$1 HRASTI It would be fairly easy to deal with single digit
    Message 1 of 8 , Mar 24, 2013
    View Source
    • 0 Attachment
      Adrian Worsfold wrote:
      > 31/12/2005 (British version, month in the middle) to become
      > 20051231
      > leading zeros is insisted upon first, as in 01/03/2013.

      ^!If ^$GetSelSize$ > 3 SKIP
      ^!Select ALL
      ^!Replace "\b(\d{2})/(\d{2})/(\d{4})\b" >> "$3$2$1" HRASTI

      It would be fairly easy to deal with single digit months and days and
      double digit years too. I always prefer putting in a little programming
      effort once to inconveniencing many people many times -- professional
      and well paid form designers prefer the exact opposite and make me want
      to bang their heads against walls.

      Axel
    • Art Kocsis
      ... Not sure what you mean by mouseover as that speaks of Javascript & HTML, not NTB Clips. If you mean mouseover to be highlighted text then just set
      Message 2 of 8 , Mar 24, 2013
      View Source
      • 0 Attachment
        At 3/24/2013 09:57 PM, Adrian wrote:
        >Hello ntb-clips
        >
        >I've got myself into a muddle, yet I should be able to do this.
        >I want, simply, any date (not today's date) as already given, as in:
        >
        >31/12/2005 (British version, month in the middle) to become 20051231
        >
        >In other words, the last four characters become the first four, the middle two numbers become the fifth and sixth and the first two numbers become the seventh and eighth numbers.
        >
        >This can be done for all such dates or just for the selected date by mouseover. The use of leading zeros is insisted upon first, as in 01/03/2013.
        >Adrian Worsfold

        Not sure what you mean by "mouseover" as that speaks of Javascript & HTML, not NTB Clips.
        If you mean "mouseover" to be highlighted text then just set %srcdate% to ^$GetSelection$.
        However you get the source, the actual conversion is a one liner [leading zeros are specified by the mm and dd masks).

        ;###### Start code
        ; %srcdate% = original date in British format dd/mm/yyyy
        ; %nbrdate% = converted date formatted: yyyymmdd

        ^!Set %nbrdate%=^$GetDateFromInt(^$GetDateToInt[(^%srcdate%;dd/mm/yyyy)]$;yyyymmdd)$
        ;###### End code

        Info on $GetDateFromInt$ and $GetDateToInt$ is in the Clip help file (search for date)
        Info on the Date and Time filter masks are in the Notetab help file (search for date)

        Art
      • Adrian Worsfold
        Hello This does not seem to work (well it doesn t) ;###### Start code ; %srcdate% = original date in British format dd/mm/yyyy ; %nbrdate% = converted date
        Message 3 of 8 , Mar 24, 2013
        View Source
        • 0 Attachment
          Hello

          This does not seem to work (well it doesn't)

          ;###### Start code
          ; %srcdate% = original date in British format dd/mm/yyyy
          ; %nbrdate% = converted date formatted: yyyymmdd
          ^!Set %nbrdate%=^$GetDateFromInt(^$GetDateToInt[(^%srcdate%;dd/mm/yyyy)]$;yyyymmdd)$
          ;###### End code

          This does work!

          ^!If ^$GetSelSize$ > 3 SKIP
          ^!Select ALL
          ^!Replace "\b(\d{2})/(\d{2})/(\d{4})\b" >> "$3$2$1" HRASTI

          Thank you both, regardless.




          Adrian Worsfold

          http://www.pluralist.co.uk
          http://pluralistspeaks.blogspot.com
          pluralist@...
          25-03-2013
          ----- Received the following content -----
          From: Axel Berger
          Receiver: ntb-clips
          Time: 2013-03-25, 05:12:29
          Subject: Re: [Clip] Juggling the date


          [Non-text portions of this message have been removed]
        • Axel Berger
          ... It ought to. Art has left it to you to set and use the variables as needed. I guess you failed to do so. Without that his conversion has nothing to go on.
          Message 4 of 8 , Mar 25, 2013
          View Source
          • 0 Attachment
            Adrian Worsfold wrote:
            > This does not seem to work (well it doesn't)

            It ought to. Art has left it to you to set and use the variables as
            needed. I guess you failed to do so. Without that his conversion has
            nothing to go on.

            Axel
          • flo.gehrke
            ... The square brackets in that code are causing a syntax error -- without them it works: ^!Set
            Message 5 of 8 , Mar 25, 2013
            View Source
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, Art Kocsis <artkns@...> wrote:
              >
              > ^!Set %nbrdate%=^$GetDateFromInt(^$GetDateToInt[(^%srcdate%;dd/mm/yyyy)]$;yyyymmdd)$

              The square brackets in that code are causing a syntax error -- without them it works:

              ^!Set %nbrdate%=^$GetDateFromInt(^$GetDateToInt(^%srcdate%;dd/mm/yyyy)$;yyyymmdd)$

              Flo
            • Art Kocsis
              ... That s because it was a test. It gave you an opportunity to look up the correct syntax in the help file (I told you where), remove the offending brackets
              Message 6 of 8 , Mar 25, 2013
              View Source
              • 0 Attachment
                At 3/24/2013 11:50 PM, you wrote:
                >Hello
                >This does not seem to work (well it doesn't)
                >
                >;###### Start code
                >; %srcdate% = original date in British format dd/mm/yyyy
                >; %nbrdate% = converted date formatted: yyyymmdd
                >^!Set %nbrdate%=^$GetDateFromInt(^$GetDateToInt[(^%srcdate%;dd/mm/yyyy)]$;yyyymmdd)$
                >;###### End code
                >Adrian Worsfold

                That's because it was a test. It gave you an opportunity to look up the correct syntax in the help file (I told you where), remove the offending brackets and witness an elegant one line solution that handles your entire problem.

                Yeah, that sounds good.

                Much better sounding than saying I forgot to remove the brackets after my paste and didn't test it before posting. Nah, I wouldn't do that. That doesn't sound good at all! ;-)

                Art
              • Adrian Worsfold
                Hello all So what did I do with this assistance? It s all about looking for jobs using the new British Government website,
                Message 7 of 8 , Mar 25, 2013
                View Source
                • 0 Attachment
                  Hello all

                  So what did I do with this assistance?

                  It's all about looking for jobs using the new British Government website, https://jobsearch.direct.gov.uk/register.aspx, where the Paste Board and then bunching together the information for each viewed vacancy causes a list of date, job title and area, the URL of details and why it cannot be applied for if not. I use this a lot, to bunch together details.

                  ^!Replace "^p^p" >> "^p" [HAS]
                  ^!Keyboard CTRL+J

                  So it produces a list...

                  First clip of recent assistance sets applications for jobs in date order and below any that begin 'FULL APPLICATION' if such was made because a y is after all but z words!


                  ^!If ^$GetSelSize$ > 3 SKIP
                  ^!Select ALL
                  ^!Replace "\b(\d{2})/(\d{2})/(\d{4})\b" >> "y:$3 m:$2 d:$1" HRASTI
                  ^!Menu Modify/Lines/Sort/Ascending
                  ^!Clip "Asterisks remove 3 all"
                  ^!Jump DOC_START
                  ^!DeleteLine
                  ^!DeleteLine

                  The second clip restores the old dates once it is all sorted. I prefer to have two clips to see what is going on.

                  ^!If ^$GetSelSize$ > 3 SKIP
                  ^!Select ALL
                  ^!Replace "y:\b(\d{4}) m:(\d{2}) d:(\d{2})\b" >> "$3/$2/$1" HRASTI
                  ^!Jump DOC_START

                  Incidentally the ^!Clip "Asterisks remove 3 all" goes to this:

                  :LOOP
                  ^!Replace "***" >> "" [WAS]
                  ^!IfError END
                  ^!GoTo LOOP
                  :END
                  ^!Clip "Tabs remove"
                  ^!Clip "Paras regularise"
                  ^!Keyboard CTRL+END

                  Thus removing Paste Board dividers set at ***

                  and the ^!Clip "Paras regularise" is as below to force even paragraphs.

                  ^!SetScreenUpdate Off

                  ^!Replace "^P " >> "^P" WAS
                  ^!IfError Next else Skip_-2

                  ^!Replace " ^P" >> "^P" WAS
                  ^!IfError Next else Skip_-2

                  ^!Replace " " >> " " WAS
                  ^!IfError Next else Skip_-2

                  ^!Replace "^P" >> "^P^P" WAS

                  ^!Replace "^P^P^P" >> "^P^P" WAS
                  ^!IfError Next else Skip_-2

                  ^!SetScreenUpdate On





                  Adrian Worsfold

                  http://www.pluralist.co.uk
                  http://pluralistspeaks.blogspot.com
                  pluralist@...
                  25-03-2013
                  ----- Received the following content -----
                  From: Axel Berger
                  Receiver: ntb-clips
                  Time: 2013-03-25, 07:02:22
                  Subject: Re: [Clip] Juggling the date


                  [Non-text portions of this message have been removed]
                Your message has been successfully submitted and would be delivered to recipients shortly.