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

Re: [Clip] anybody have a clip for date reformats?

Expand Messages
  • Ian at Yahoo
    Don, This won t solve your problem but may move you to a more reusable solution ^$datefix(25/12/2010)$ result returned=2010-12-25T00:00:00 or
    Message 1 of 13 , Dec 16 4:37 AM
      Don,

      This won't solve your problem but may move you to a more reusable solution

      ^$datefix(25/12/2010)$

      result returned=2010-12-25T00:00:00

      or
      ^$datefix(12/25/2010//mdy)$
      returns=2010-12-25T00:00:00


      H="_datefix"
      ^!SetListDelimiter //
      ^!setarray %data%=^&
      ^!SetListDelimiter /
      ^!setarray %datefield%=^%data1%

      ^!IfEmpty ^%data2% dmy else mdy
      :dmy
      ^!set
      %datex%=^$fullyear(^%datefield3%)$-^$2digit(^%datefield2%)$-^$2digit(^%datefield1%)$T00:00:00
      ^!goto enddatefix

      :MDY
      ^!set
      %datex%=^$fullyear(^%datefield3%)$-^$2digit(^%datefield1%)$-^$2digit(^%datefield2%)$T00:00:00

      :enddatefix
      ^!Result ^%datex%

      H="_fullyear"
      ^!setdebug off
      ^!if ^$StrSize("^&")$>2 nofix
      ^!if ^&<70 fix2000
      ^!set %back%=19^&
      ^!goto endyear

      :fix2000
      ^!set %back%=20^&
      ^!goto endyear

      :nofix
      ^!set %back%=^&

      :endyear
      ^!Result ^%back%

      H="_2digit"
      ^!if ^$StrSize("^&")$>1 high else low

      :low
      ^!set %output%=0^&
      ^!goto end2digit

      :high
      ^!set %output%=^&
      :end2digit
      ^!Result ^%output%

      Ian

      On 16/12/2010 4:17 AM, Don wrote:
      >
      > Fair thoughts Axel,
      >
      > I am working on a list that ONLY contains dates/time in this case, so
      > that part is easy.
      >
      > I was working in my mind on making a loop to add 12 or zero pad the
      > hours etc. Hence my desire to see what others may do.
      >
      > My first line works Alex because my data is actually something like this:
      > Monday, October 18, 2010 3:04 PM
      > Friday, October 29, 2010 2:56 PM
      > Tuesday, November 23, 2010 12:33 AM
      > Friday, August 28, 2009 3:28 PM
      > Sunday, August 30, 2009 7:20 AM
      >
      > I did not show the days in my original question. But it was the
      > pondering of what to do with the hours (AM/PM) that originally got me
      > debating what others may be using.
      >
      > Don
      >
      > On 12/15/2010 8:12 AM, Axel Berger wrote:
      > > Don wrote:
      > >> This is a clip I plan to use regularly so it's worthy perhaps
      > >> of trying to improve it, not to mention I learn stuff.
      > >
      > > As I've said repeatly I like the primitive and obvious style. I see two
      > > problems:
      > >
      > > 1) You will replace all months mentioned in the normal text flow with
      > > numbers.
      > > 2) You will change all times mentioned in the text.
      >
      >



      [Non-text portions of this message have been removed]
    • Ian at Yahoo
      This will solve the original problem in a script not using RE. array2var and loopA are two reusable clips. month and ampm clips are also reusable data (if you
      Message 2 of 13 , Dec 16 7:41 PM
        This will solve the original problem in a script not using RE.

        array2var and loopA are two reusable clips.
        month and ampm clips are also reusable data (if you complete the months).

        Ian

        H="_inputdata"
        October 18, 2010 3:04 PM
        October 29, 2010 2:56 PM
        November 23, 2010 12:33 AM
        August 28, 2009 3:28 PM

        H="_month"
        October 10
        November 11
        August 08

        H="_ampm"
        am1 01
        am2 02
        am3 03
        am4 04
        am5 05
        am6 06
        am7 07
        am8 08
        am9 09
        am10 10
        am11 11
        am12 00
        pm1 13
        pm2 14
        pm3 15
        pm4 16
        pm5 17
        pm6 18
        pm7 19
        pm8 20
        pm9 21
        pm10 22
        pm11 23
        pm12 12

        H="main"
        ^!clip "array2var" month
        ^!clip "array2var" ampm
        ^!SetListDelimiter ^p
        ^!SetArray %arrayA%=^$GetClipText("inputdata")$
        ^$loopA(parseline)$

        H="_parseline"
        ^!SetListDelimiter " "
        ^!set %allfield%=^$StrReplace(",";"";"^&";Yes;Yes)$
        ^!setarray %field%=^$StrReplace(":";" ";"^%allfield%";Yes;Yes)$
        ^%field3%-^%^%field1%%-^%field2%T^%^%field6%^%field4%%:^%field5%:00

        H="_array2var"
        ; Input in the form (clip table to find item)
        ^!SetListDelimiter ^p
        ^!SetArray %line%=^$GetClipText("^&")$

        ^!Set %mIndex%=0
        ^!Set %mLoopCount%=^%line0%
        ^!IfCancel End
        :mLoopStart
        ^!Inc %mIndex%
        ^!If ^%mIndex% > ^%mLoopCount% mEndLoop
        ^!SetListDelimiter ^t
        ^!SetArray %field%=^%line^%mindex%%
        ^!set %^%field1%%=^%field2%
        ^!GoTo mLoopStart
        :mEndLoop


        H="_LoopA"
        ^!Set %Indexa%=0
        ^!Set %LoopCounta%=^%arraya0%
        ^!IfCancel End

        :LoopStarta
        ^!Inc %Indexa%
        ^!If ^%Indexa% > ^%LoopCounta% EndLoopa
        ^!clip "^&" ^%arraya^%indexa%%

        ^!GoTo LoopStarta
        :EndLoopa

        On 16/12/2010 4:17 AM, Don wrote:
        >
        > Fair thoughts Axel,
        >
        > I am working on a list that ONLY contains dates/time in this case, so
        > that part is easy.
        >
        > I was working in my mind on making a loop to add 12 or zero pad the
        > hours etc. Hence my desire to see what others may do.
        >
        > My first line works Alex because my data is actually something like this:
        > Monday, October 18, 2010 3:04 PM
        > Friday, October 29, 2010 2:56 PM
        > Tuesday, November 23, 2010 12:33 AM
        > Friday, August 28, 2009 3:28 PM
        > Sunday, August 30, 2009 7:20 AM
        >
        > I did not show the days in my original question. But it was the
        > pondering of what to do with the hours (AM/PM) that originally got me
        > debating what others may be using.
        >
        > Don
        >
        > On 12/15/2010 8:12 AM, Axel Berger wrote:
        > > Don wrote:
        > >> This is a clip I plan to use regularly so it's worthy perhaps
        > >> of trying to improve it, not to mention I learn stuff.
        > >
        > > As I've said repeatly I like the primitive and obvious style. I see two
        > > problems:
        > >
        > > 1) You will replace all months mentioned in the normal text flow with
        > > numbers.
        > > 2) You will change all times mentioned in the text.
        >
        >



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