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

Re: [Clip] Entering a different date

Expand Messages
  • Lee Underwood
    Thanks, but I can get the current date. I need to know how to enter a future date and then display it in the different formats I listed. Lee On 8/4/2006 03:57
    Message 1 of 9 , Aug 4, 2006
    • 0 Attachment
      Thanks, but I can get the current date. I need to know how to enter a
      future date and then display it in the different formats I listed.

      Lee


      On 8/4/2006 03:57 PM, Jeff Scism wrote:
      ........................................................

      >^!ClearVariables
      >
      >^!Set %date1%=^$GetDate(dddd)$
      >^!Set %date2%=^$GetDate(mmmm)$
      >^!Set %date3%=^$GetDate(dd)$
      >^!Set %date4%=^$GetDate(yyyy)$
      >^!Set %hours%=^$GetDate(hh)$
      >^!Set %mins%=^$GetDate(nn)$
      >^!InsertText ^%date1%, ^%date2% ^%date3%, ^%date4%, ^%hours%:^%mins%
      >
      >~~
      >
      >Jeffery Scism,
      >USGenWeb Project Local Coordinator Rep
      >NC/NE region
      ........................................................
    • hsavage
      ... yyyy)$} ... Lee, What you re considering will require a minimum of 3 variables if you go the quick way. Below is a short demo clip showing 2 methods for
      Message 2 of 9 , Aug 4, 2006
      • 0 Attachment
        Lee Underwood wrote:
        > (I have looked online and through my archives and couldn't find a
        > clip that did this.)
        >
        > I need a clip that asks for a date. Something like:
        >
        > ^!Set %postDate%=^?{Enter Posting Date of Script=^$GetDate(mmmm d,
        yyyy)$}
        >
        > I then need to place that date in three different places in the
        > following formats:
        >
        > mmmm d, yyyy
        > mm-dd-yy
        > yyyy-mm-dd
        >
        > I'm guessing the latter portion would be just a matter of (somehow)
        > placing the formatted date into a variable.
        >
        > Lee

        Lee,

        What you're considering will require a minimum of 3 variables if you go
        the quick way. Below is a short demo clip showing 2 methods for
        extracting the date in different forms followed by the output of each
        method. Just use either form in the appropriate place in the clip to
        enter the current date in the form you require.

        h=testdate
        ^[mmmm d, yyyy^]
        ^[mm-dd-yy^]
        ^[yyyy-mm-dd^]
        ;------------
        ^$GetDate(mmmm d, yyyy)$
        ^$GetDate(mm-dd-yy)$
        ^$GetDate(yyyy-mm-dd)$
        ;------------

        August 4, 2006
        08-04-06
        2006-08-04

        August 4, 2006
        08-04-06
        2006-08-04


        ºvº
        06.08.04_15.31
        "Chaos, Panic, & Disorder - My work here is done."
        hrs ø hsavage@...
      • hsavage
        ... Lee, I should have read ahead, how about a couple of specific examples? Will the future date be fixed for a certain time span in the future or will it be
        Message 3 of 9 , Aug 4, 2006
        • 0 Attachment
          Lee Underwood wrote:
          > Thanks, but I can get the current date. I need to know how to enter a
          > future date and then display it in the different formats I listed.
          >
          > Lee
          >
          >
          > On 8/4/2006 03:57 PM, Jeff Scism wrote:
          > ........................................................
          >
          >> ^!ClearVariables
          >>
          >> ^!Set %date1%=^$GetDate(dddd)$
          >> ^!Set %date2%=^$GetDate(mmmm)$
          >> ^!Set %date3%=^$GetDate(dd)$
          >> ^!Set %date4%=^$GetDate(yyyy)$
          >> ^!Set %hours%=^$GetDate(hh)$
          >> ^!Set %mins%=^$GetDate(nn)$
          >> ^!InsertText ^%date1%, ^%date2% ^%date3%, ^%date4%, ^%hours%:^%mins%
          >>
          >> ~~
          >>
          >> Jeffery Scism,

          Lee,

          I should have read ahead, how about a couple of specific examples?

          Will the future date be fixed for a certain time span in the future or
          will it be set on the spur of the moment?

          You may have to do some date-calcs.

          ºvº
          06.08.04_15.31
          "Chaos, Panic, & Disorder - My work here is done."
          hrs ø hsavage@...
        • Lee Underwood
          I have an .INI file that creates files for future posting. I just basically need a clip that asks What will the date be? and then format it into the three
          Message 4 of 9 , Aug 4, 2006
          • 0 Attachment
            I have an .INI file that creates files for future
            posting. I just basically need a clip that asks
            "What will the date be?" and then format it into
            the three different formats. It doesn't need to
            be run more than once during a session.

            Lee


            On 8/4/2006 04:50 PM, hsavage wrote:
            ........................................................

            >Lee,
            >
            >I should have read ahead, how about a couple of specific examples?
            >
            >Will the future date be fixed for a certain time span in the future or
            >will it be set on the spur of the moment?
            >
            >You may have to do some date-calcs.
            >
            > ºvº
            > 06.08.04_15.31
            > "Chaos, Panic, & Disorder - My work here is done."
            > hrs ø hsavage@...
            >
            >
            ........................................................
          • John Zeman
            ... Here ya go mate. I can t take credit for this clip however, the main engine that parses the date you enter was written by Steve Veltkamp several years
            Message 5 of 9 , Aug 4, 2006
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, Lee Underwood <leeu@...> wrote:
              >
              > I just basically need a clip that asks
              > "What will the date be?" and then format it into
              > the three different formats. It doesn't need to
              > be run more than once during a session.
              >
              > Lee
              >
              >



              Here ya go mate. I can't take credit for this clip however, the main
              engine that parses the date you enter was written by Steve Veltkamp
              several years ago. To this day I use it all the time for needs such
              as yours.

              You should be able to adapt it to the format you need.

              John



              ;begin clip to insert any date in long form

              ^!Set %indtg%=^?{(M="00/00/0000;1;*")Enter Date (mm/dd/yyyy)}
              ^!Set %y%=^$StrCopy(^%indtg%;7;4)$
              ^!Set %m%=^$StrCopy(^%indtg%;1;2)$
              ^!Set %d%=^$StrCopy(^%indtg%;4;2)$

              ^!If ^%m%<3 z1
              :z
              ^!Set %z%=^%y%
              ^!Goto calc
              :z1
              ^!Set %z%=^$CALC(^%y%-1)$
              :calc
              ^!Set %z4%=^$CALC(^%z%/4;3)$
              ^!Set %iz4%=^$CALC(INT(^%z4%))$
              ^!Set %z100%=^$CALC(^%z%/100;3)$
              ^!Set %iz100%=^$CALC(INT(^%z100%))$
              ^!Set %z400%=^$CALC(^%z%/400;3)$
              ^!Set %iz400%=^$CALC(INT(^%z400%))$
              ^!Set %m23%=^$CALC(^%m%*23)$
              ^!Set %m9%=^$CALC(^%m23%/9;3)$
              ^!Set %im9%=^$CALC(INT(^%m9%))$
              ^!If ^%m%<3 DOW1
              :DOW
              ^!Set %dow%=^$CALC(^%im9%+^%d%+4+^%z%+^%iz4%-^%iz100%+^%iz400%-2)$
              ^!Set %day%=^$CALC(^%dow%MOD7)$
              ^!Goto Weekday
              :DOW1
              ^!Set %dow%=^$CALC(^%im9%+^%d%+4+^%z%+^%iz4%-^%iz100%+^%iz400%+1)$
              ^!Set %day%=^$CALC(^%dow%MOD7)$
              ^!if ^%m%=01 ^!Set %month%="January"
              ^!if ^%m%=02 ^!Set %month%="February"
              ^!if ^%m%=03 ^!Set %month%="March"
              ^!if ^%m%=04 ^!Set %month%="April"
              ^!if ^%m%=05 ^!Set %month%="May"
              ^!if ^%m%=06 ^!Set %month%="June"
              ^!if ^%m%=07 ^!Set %month%="July"
              ^!if ^%m%=08 ^!Set %month%="August"
              ^!if ^%m%=09 ^!Set %month%="September"
              ^!if ^%m%=10 ^!Set %month%="October"
              ^!if ^%m%=11 ^!Set %month%="November"
              ^!if ^%m%=12 ^!Set %month%="December"
              :Weekday
              ^!if ^%m%=01 ^!Set %month%="January"
              ^!if ^%m%=02 ^!Set %month%="February"
              ^!if ^%m%=03 ^!Set %month%="March"
              ^!if ^%m%=04 ^!Set %month%="April"
              ^!if ^%m%=05 ^!Set %month%="May"
              ^!if ^%m%=06 ^!Set %month%="June"
              ^!if ^%m%=07 ^!Set %month%="July"
              ^!if ^%m%=08 ^!Set %month%="August"
              ^!if ^%m%=09 ^!Set %month%="September"
              ^!if ^%m%=10 ^!Set %month%="October"
              ^!if ^%m%=11 ^!Set %month%="November"
              ^!if ^%m%=12 ^!Set %month%="December"
              ^!if ^%day%=0 ^!Set %day%="Sunday"
              ^!if ^%day%=1 ^!Set %day%="Monday"
              ^!if ^%day%=2 ^!Set %day%="Tuesday"
              ^!if ^%day%=3 ^!Set %day%="Wednesday"
              ^!if ^%day%=4 ^!Set %day%="Thursday"
              ^!if ^%day%=5 ^!Set %day%="Friday"
              ^!if ^%day%=6 ^!Set %day%="Saturday"


              ^!InsertText ^%day%, ^%month% ^%d%, ^%y%
            • abairheart
              Hmm, instead of all the if statements, why not have arrays for these case, i.e. ^!SetArray %dayofweek%=Sunday;Monday;... ^!SetArray
              Message 6 of 9 , Aug 6, 2006
              • 0 Attachment
                Hmm, instead of all the if statements, why not have arrays
                for these case, i.e.

                ^!SetArray %dayofweek%=Sunday;Monday;...
                ^!SetArray %monthname%=January;February;...


                When you need to extract the day of week, increment the index:
                ^!Inc %day%
                ^!Set %day%=^%dayofweek^%day%%

                For months, you will not have to increment:
                ^!Set %month%=^%monthname^%month%%



                Abair.



                --- In ntb-clips@yahoogroups.com, "John Zeman" <john041650@...> wrote:
                >
                > --- In ntb-clips@yahoogroups.com, Lee Underwood <leeu@> wrote:
                >
                >
                > ;begin clip to insert any date in long form
                >
                > ^!Set %indtg%=^?{(M="00/00/0000;1;*")Enter Date (mm/dd/yyyy)}
                > ^!Set %y%=^$StrCopy(^%indtg%;7;4)$
                > ^!Set %m%=^$StrCopy(^%indtg%;1;2)$
                > ^!Set %d%=^$StrCopy(^%indtg%;4;2)$
                >
                > ^!If ^%m%<3 z1
                > :z
                > ^!Set %z%=^%y%
                > ^!Goto calc
                > :z1
                > ^!Set %z%=^$CALC(^%y%-1)$
                > :calc
                > ^!Set %z4%=^$CALC(^%z%/4;3)$
                > ^!Set %iz4%=^$CALC(INT(^%z4%))$
                > ^!Set %z100%=^$CALC(^%z%/100;3)$
                > ^!Set %iz100%=^$CALC(INT(^%z100%))$
                > ^!Set %z400%=^$CALC(^%z%/400;3)$
                > ^!Set %iz400%=^$CALC(INT(^%z400%))$
                > ^!Set %m23%=^$CALC(^%m%*23)$
                > ^!Set %m9%=^$CALC(^%m23%/9;3)$
                > ^!Set %im9%=^$CALC(INT(^%m9%))$
                > ^!If ^%m%<3 DOW1
                > :DOW
                > ^!Set %dow%=^$CALC(^%im9%+^%d%+4+^%z%+^%iz4%-^%iz100%+^%iz400%-2)$
                > ^!Set %day%=^$CALC(^%dow%MOD7)$
                > ^!Goto Weekday
                > :DOW1
                > ^!Set %dow%=^$CALC(^%im9%+^%d%+4+^%z%+^%iz4%-^%iz100%+^%iz400%+1)$
                > ^!Set %day%=^$CALC(^%dow%MOD7)$
                > ^!if ^%m%=01 ^!Set %month%="January"
                > ^!if ^%m%=02 ^!Set %month%="February"
                > ^!if ^%m%=03 ^!Set %month%="March"
                > ^!if ^%m%=04 ^!Set %month%="April"
                > ^!if ^%m%=05 ^!Set %month%="May"
                > ^!if ^%m%=06 ^!Set %month%="June"
                > ^!if ^%m%=07 ^!Set %month%="July"
                > ^!if ^%m%=08 ^!Set %month%="August"
                > ^!if ^%m%=09 ^!Set %month%="September"
                > ^!if ^%m%=10 ^!Set %month%="October"
                > ^!if ^%m%=11 ^!Set %month%="November"
                > ^!if ^%m%=12 ^!Set %month%="December"
                > :Weekday
                > ^!if ^%m%=01 ^!Set %month%="January"
                > ^!if ^%m%=02 ^!Set %month%="February"
                > ^!if ^%m%=03 ^!Set %month%="March"
                > ^!if ^%m%=04 ^!Set %month%="April"
                > ^!if ^%m%=05 ^!Set %month%="May"
                > ^!if ^%m%=06 ^!Set %month%="June"
                > ^!if ^%m%=07 ^!Set %month%="July"
                > ^!if ^%m%=08 ^!Set %month%="August"
                > ^!if ^%m%=09 ^!Set %month%="September"
                > ^!if ^%m%=10 ^!Set %month%="October"
                > ^!if ^%m%=11 ^!Set %month%="November"
                > ^!if ^%m%=12 ^!Set %month%="December"
                > ^!if ^%day%=0 ^!Set %day%="Sunday"
                > ^!if ^%day%=1 ^!Set %day%="Monday"
                > ^!if ^%day%=2 ^!Set %day%="Tuesday"
                > ^!if ^%day%=3 ^!Set %day%="Wednesday"
                > ^!if ^%day%=4 ^!Set %day%="Thursday"
                > ^!if ^%day%=5 ^!Set %day%="Friday"
                > ^!if ^%day%=6 ^!Set %day%="Saturday"
                >
                >
                > ^!InsertText ^%day%, ^%month% ^%d%, ^%y%
                >
              • Lee Underwood
                John, Sorry for taking so long to get back ... just real busy. That s the answer I was looking for! Thanks. I also learned a bit from it. Lee On 8/4/2006 08:31
                Message 7 of 9 , Aug 21, 2006
                • 0 Attachment
                  John,

                  Sorry for taking so long to get back ... just real busy.

                  That's the answer I was looking for! Thanks. I also learned a bit from it.

                  Lee


                  On 8/4/2006 08:31 PM, John Zeman wrote:
                  ........................................................

                  >Here ya go mate. I can't take credit for this clip however, the
                  >main engine that parses the date you enter was written by Steve
                  >Veltkamp several years ago. To this day I use it all the time for
                  >needs such as yours.
                  >
                  >You should be able to adapt it to the format you need.
                  >
                  >John
                  >
                  >;begin clip to insert any date in long form
                  >
                  >^!Set %indtg%=^?{(M="00/00/0000;1;*")Enter Date (mm/dd/yyyy)}
                  >^!Set %y%=^$StrCopy(^%indtg%;7;4)$
                  >^!Set %m%=^$StrCopy(^%indtg%;1;2)$
                  >^!Set %d%=^$StrCopy(^%indtg%;4;2)$
                  >
                  >^!If ^%m%<3 z1
                  >:z
                  >^!Set %z%=^%y%
                  >^!Goto calc
                  >:z1
                  >^!Set %z%=^$CALC(^%y%-1)$
                  >:calc
                  >^!Set %z4%=^$CALC(^%z%/4;3)$
                  >^!Set %iz4%=^$CALC(INT(^%z4%))$
                  >^!Set %z100%=^$CALC(^%z%/100;3)$
                  >^!Set %iz100%=^$CALC(INT(^%z100%))$
                  >^!Set %z400%=^$CALC(^%z%/400;3)$
                  >^!Set %iz400%=^$CALC(INT(^%z400%))$
                  >^!Set %m23%=^$CALC(^%m%*23)$
                  >^!Set %m9%=^$CALC(^%m23%/9;3)$
                  >^!Set %im9%=^$CALC(INT(^%m9%))$
                  >^!If ^%m%<3 DOW1
                  >:DOW
                  >^!Set %dow%=^$CALC(^%im9%+^%d%+4+^%z%+^%iz4%-^%iz100%+^%iz400%-2)$
                  >^!Set %day%=^$CALC(^%dow%MOD7)$
                  >^!Goto Weekday
                  >:DOW1
                  >^!Set %dow%=^$CALC(^%im9%+^%d%+4+^%z%+^%iz4%-^%iz100%+^%iz400%+1)$
                  >^!Set %day%=^$CALC(^%dow%MOD7)$
                  >^!if ^%m%=01 ^!Set %month%="January"
                  >^!if ^%m%=02 ^!Set %month%="February"
                  >^!if ^%m%=03 ^!Set %month%="March"
                  >^!if ^%m%=04 ^!Set %month%="April"
                  >^!if ^%m%=05 ^!Set %month%="May"
                  >^!if ^%m%=06 ^!Set %month%="June"
                  >^!if ^%m%=07 ^!Set %month%="July"
                  >^!if ^%m%=08 ^!Set %month%="August"
                  >^!if ^%m%=09 ^!Set %month%="September"
                  >^!if ^%m%=10 ^!Set %month%="October"
                  >^!if ^%m%=11 ^!Set %month%="November"
                  >^!if ^%m%=12 ^!Set %month%="December"
                  >:Weekday
                  >^!if ^%m%=01 ^!Set %month%="January"
                  >^!if ^%m%=02 ^!Set %month%="February"
                  >^!if ^%m%=03 ^!Set %month%="March"
                  >^!if ^%m%=04 ^!Set %month%="April"
                  >^!if ^%m%=05 ^!Set %month%="May"
                  >^!if ^%m%=06 ^!Set %month%="June"
                  >^!if ^%m%=07 ^!Set %month%="July"
                  >^!if ^%m%=08 ^!Set %month%="August"
                  >^!if ^%m%=09 ^!Set %month%="September"
                  >^!if ^%m%=10 ^!Set %month%="October"
                  >^!if ^%m%=11 ^!Set %month%="November"
                  >^!if ^%m%=12 ^!Set %month%="December"
                  >^!if ^%day%=0 ^!Set %day%="Sunday"
                  >^!if ^%day%=1 ^!Set %day%="Monday"
                  >^!if ^%day%=2 ^!Set %day%="Tuesday"
                  >^!if ^%day%=3 ^!Set %day%="Wednesday"
                  >^!if ^%day%=4 ^!Set %day%="Thursday"
                  >^!if ^%day%=5 ^!Set %day%="Friday"
                  >^!if ^%day%=6 ^!Set %day%="Saturday"
                  >
                  >
                  >^!InsertText ^%day%, ^%month% ^%d%, ^%y%
                  ........................................................
                Your message has been successfully submitted and would be delivered to recipients shortly.