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

23721Re: [Clip] Juggling the date

Expand Messages
  • Art Kocsis
    Mar 24, 2013
      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)

    • Show all 8 messages in this topic