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

More Date Function Bugs?

Expand Messages
  • ebbtidalflats
    Hi all, Eric, Can anyone verify if the following functions work? H= Test Date To Int ^!Set %date%=Tue, Jun 01, 2010 ;1 variable, no quotes ^!Set
    Message 1 of 5 , Apr 27 11:38 AM
    View Source
    • 0 Attachment
      Hi all, Eric,

      Can anyone verify if the following functions work?

      H="Test Date To Int"
      ^!Set %date%=Tue, Jun 01, 2010
      ;1 variable, no quotes
      ^!Set %dateNum%=^$GetDateToInt(^%date%;ddd, mmm dd, yyyy)$
      ;2 variable, quotes in format
      ^!Set %dateNum%=^$GetDateToInt(^%date%;ddd', 'mmm dd', 'yyyy)$
      ;3 literal WITH quotes on all extras
      ^!Set %dateNum%=^$GetDateToInt(Tue', 'Jun 01', '2010;ddd', 'mmm dd', 'yyyy)$
      ;4 literal W/O quotes in date
      ^!Set %dateNum%=^$GetDateToInt(Tue, Jun 01, 2010;ddd', 'mmm dd', 'yyyy)$
      ;5 literal, W/O quotes in format
      ^!Set %dateNum%=^$GetDateToInt(Tue', 'Jun 01', '2010;ddd, mmm dd, yyyy)$
      ;6 literal, W/O any quotes
      ^!Set %dateNum%=^$GetDateToInt(Tue, Jun 01, 2010;ddd, mmm dd, yyyy)$
      ; end of clip (this is line 15)

      I tried all six (and then some) but they all return EMPTY.


      Cheers,

      Eb
    • ebbtidalflats
      Don t you just hate it when people reply to their own messages?! Sorry, I forgot to mention, that using a different SIMPLE date format, the function below
      Message 2 of 5 , Apr 27 11:54 AM
      View Source
      • 0 Attachment
        Don't you just hate it when people reply to their own messages?!

        Sorry, I forgot to mention, that using a different SIMPLE date format, the function below still works. I.e. If the date and format is, for example "2010-06-01;yyyy-mm-dd".

        But Eric, in the real world, one encounters dates in various different formats. The one I had trouble with is straight from a web page, for which I had wanted to calculate the number of days in the future. It is of course possible to convert the date one finds into a format that is acceptable to NoteTab, but that would require so much clip code that I might as well use an external engine, which uses dates a'la Perl. Then I wouldn't need the NoteTab function at all.

        But I dislike using external utilities that some of my clients may not have installed!

        Eb


        --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@...> wrote:
        >
        > Hi all, Eric,
        >
        > Can anyone verify if the following functions work?
        >
        > H="Test Date To Int"
        > ^!Set %date%=Tue, Jun 01, 2010
        > ;1 variable, no quotes
        > ^!Set %dateNum%=^$GetDateToInt(^%date%;ddd, mmm dd, yyyy)$
        > ;2 variable, quotes in format
        > ^!Set %dateNum%=^$GetDateToInt(^%date%;ddd', 'mmm dd', 'yyyy)$
        > ;3 literal WITH quotes on all extras
        > ^!Set %dateNum%=^$GetDateToInt(Tue', 'Jun 01', '2010;ddd', 'mmm dd', 'yyyy)$
        > ;4 literal W/O quotes in date
        > ^!Set %dateNum%=^$GetDateToInt(Tue, Jun 01, 2010;ddd', 'mmm dd', 'yyyy)$
        > ;5 literal, W/O quotes in format
        > ^!Set %dateNum%=^$GetDateToInt(Tue', 'Jun 01', '2010;ddd, mmm dd, yyyy)$
        > ;6 literal, W/O any quotes
        > ^!Set %dateNum%=^$GetDateToInt(Tue, Jun 01, 2010;ddd, mmm dd, yyyy)$
        > ; end of clip (this is line 15)
        >
        > I tried all six (and then some) but they all return EMPTY.
        >
        >
        > Cheers,
        >
        > Eb
        >
      • diodeom
        If I understand it correctly, ^$GetDateToInt()$ requires three values to perform its calculation (figuring the number of days that have passed since
        Message 3 of 5 , Apr 27 3:49 PM
        View Source
        • 0 Attachment
          If I understand it correctly, ^$GetDateToInt()$ requires three values to perform its calculation (figuring "the number of days that have passed since 12/30/1899"); no more, no less. Any date filters except for the mandatory day of the month, month and year -- ought to be pretty useless here, I think. Days (of the month) and years are conveniently (to the function :) always numerical to begin with; the only issue then could pertain to months -- if named (either mmm or mmmm). No doubt, it would be easier to have their conversion to digits handled automatically, though I don't see how it would take much to prep them in a clip beforehand (particularly for someone of your expertise).

          I (occasionally) utilize this simple custom function, which -- after receiving a variable name in either "mmmm" or "mmm" format -- returns the desired number ("m") through ^$MonthNumber()$.

          (In a parent clip:)
          ^$MonthNumber(Apr)$

          H="MonthNumber"
          ;long line start
          ^!Result ^$Calc((^$StrPos("^$StrCopyLeft("^&";3)$";"JanFebMarAprMayJunJulAugSepOctNovDec";0)$+2)/3)$
          ;long line end

          If I may chime along with an OT line of a devil's advocate: While I do wish that certain sections of various Help files were a bit more elaborate, I almost regret that the available commands and functions provide outright as much as they do. I mean, what's there left for us to do but to (more-or-less haphazardly) glue up some ready-made components together? ;)


          --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@...> wrote:
          >
          > Don't you just hate it when people reply to their own messages?!
          >
          > Sorry, I forgot to mention, that using a different SIMPLE date format, the function below still works. I.e. If the date and format is, for example "2010-06-01;yyyy-mm-dd".
          >
          > But Eric, in the real world, one encounters dates in various different formats. The one I had trouble with is straight from a web page, for which I had wanted to calculate the number of days in the future. It is of course possible to convert the date one finds into a format that is acceptable to NoteTab, but that would require so much clip code that I might as well use an external engine, which uses dates a'la Perl. Then I wouldn't need the NoteTab function at all.
          >
          > But I dislike using external utilities that some of my clients may not have installed!
          >
          > Eb
          >
          >
          > --- In ntb-clips@yahoogroups.com, "ebbtidalflats" <ebbtidalflats@> wrote:
          > >
          > > Hi all, Eric,
          > >
          > > Can anyone verify if the following functions work?
          > >
          > > H="Test Date To Int"
          > > ^!Set %date%=Tue, Jun 01, 2010
          > > ;1 variable, no quotes
          > > ^!Set %dateNum%=^$GetDateToInt(^%date%;ddd, mmm dd, yyyy)$
          > > ;2 variable, quotes in format
          > > ^!Set %dateNum%=^$GetDateToInt(^%date%;ddd', 'mmm dd', 'yyyy)$
          > > ;3 literal WITH quotes on all extras
          > > ^!Set %dateNum%=^$GetDateToInt(Tue', 'Jun 01', '2010;ddd', 'mmm dd', 'yyyy)$
          > > ;4 literal W/O quotes in date
          > > ^!Set %dateNum%=^$GetDateToInt(Tue, Jun 01, 2010;ddd', 'mmm dd', 'yyyy)$
          > > ;5 literal, W/O quotes in format
          > > ^!Set %dateNum%=^$GetDateToInt(Tue', 'Jun 01', '2010;ddd, mmm dd, yyyy)$
          > > ;6 literal, W/O any quotes
          > > ^!Set %dateNum%=^$GetDateToInt(Tue, Jun 01, 2010;ddd, mmm dd, yyyy)$
          > > ; end of clip (this is line 15)
          > >
          > > I tried all six (and then some) but they all return EMPTY.
          > >
          > >
          > > Cheers,
          > >
          > > Eb
          > >
          >
        • Dave
          H= Test Date To Int ^!Set %date%=11/06/2008 ^$GetDateToInt(^%date%;dd/mm/yyyy)$ this is the only one that works . THANKYOU DAVE M ... From: ebbtidalflats
          Message 4 of 5 , Apr 28 6:53 AM
          View Source
          • 0 Attachment
            H="Test Date To Int"
            ^!Set %date%=11/06/2008
            ^$GetDateToInt(^%date%;dd/mm/yyyy)$
            this is the only one that works .
            THANKYOU DAVE M

            ----- Original Message -----
            From: "ebbtidalflats" <ebbtidalflats@...>
            To: <ntb-clips@yahoogroups.com>
            Sent: Wednesday, April 28, 2010 4:38 AM
            Subject: [Clip] More Date Function Bugs?


            > Hi all, Eric,
            >
            > Can anyone verify if the following functions work?
            >
            > H="Test Date To Int"
            > ^!Set %date%=Tue, Jun 01, 2010
            > ;1 variable, no quotes
            > ^!Set %dateNum%=^$GetDateToInt(^%date%;ddd, mmm dd, yyyy)$
            > ;2 variable, quotes in format
            > ^!Set %dateNum%=^$GetDateToInt(^%date%;ddd', 'mmm dd', 'yyyy)$
            > ;3 literal WITH quotes on all extras
            > ^!Set %dateNum%=^$GetDateToInt(Tue', 'Jun 01', '2010;ddd', 'mmm dd',
            > 'yyyy)$
            > ;4 literal W/O quotes in date
            > ^!Set %dateNum%=^$GetDateToInt(Tue, Jun 01, 2010;ddd', 'mmm dd', 'yyyy)$
            > ;5 literal, W/O quotes in format
            > ^!Set %dateNum%=^$GetDateToInt(Tue', 'Jun 01', '2010;ddd, mmm dd, yyyy)$
            > ;6 literal, W/O any quotes
            > ^!Set %dateNum%=^$GetDateToInt(Tue, Jun 01, 2010;ddd, mmm dd, yyyy)$
            > ; end of clip (this is line 15)
            >
            > I tried all six (and then some) but they all return EMPTY.
            >
            >
            > Cheers,
            >
            > Eb
            >
            >
            >
            >
            > ------------------------------------
            >
            > Fookes Software: http://www.fookes.com/
            > NoteTab website: http://www.notetab.com/
            > NoteTab Discussion Lists: http://www.notetab.com/groups.php
            >
            > ***
            > Yahoo! Groups Links
            >
            >
            >
            >
          • ebbtidalflats
            Thanks for the replies, Dave & Diodem, I do have the three-part date argument working as well, but I interpreted the help differently. Given the use of the
            Message 5 of 5 , Apr 28 3:49 PM
            View Source
            • 0 Attachment
              Thanks for the replies, Dave & Diodem,

              I do have the three-part date argument working as well, but I interpreted the help differently. Given the use of the date mask, I expected the function to know which argument it needed, and which to discard. Guess I was wrong.


              --- In ntb-clips@yahoogroups.com, "diodeom" <diomir@...> wrote:
              >
              > ... ^$GetDateToInt()$ requires three values to perform its
              > calculation ...; no more, no less.
              > ...


              It turned out that 6 lines of code achieved what I needed (the number of days from present to the date in the document).


              > I (occasionally) utilize this simple custom function, which -- after receiving a variable name in either "mmmm" or "mmm" format -- returns the desired number ("m") through ^$MonthNumber()$.
              >
              > (In a parent clip:)
              > ^$MonthNumber(Apr)$
              >
              > H="MonthNumber"
              > ;long line start
              > ^!Result ^$Calc((^$StrPos("^$StrCopyLeft("^&";3)$";"JanFebMarAprMayJunJulAugSepOctNovDec";0)$+2)/3)$
              > ;long line end
              >

              Very nice. More compact than what I used.




              Cheers,


              Eb
            Your message has been successfully submitted and would be delivered to recipients shortly.