JoinDate

Transform a numeric vector (Y M D ...) or simple matrix with three or more columns into a scalar or vector of Integers representing YYYYMMDD per item.

      100⊥3↑[⎕IO]⍉IA

Examples

      100⊥3↑[⎕IO]⍉ 2010 8 29 112
20100829
      100⊥3↑[⎕IO]⍉ ⊃(2010 8 29 112) (999 1 2)
20100829 9990102
      100⊥3↑[⎕IO]⍉⊃(2010 8 29 112)(999 1 2 0)(3000 1 1 0)(3000 12 31 0)
20100829 9990102 30000101 30001231

Compatibility

Checked with: APL2, APLX, Dyalog, NARS2000

Test Cases

Show test cases

Test
 ⎕IO←0      ⍝ You may change this; however, zero IS the default in the PhraseBook
  ⎕FX ⍕2 1⍴'r←JoinDate y' 'r← 100⊥3↑[⎕IO]⍉y'   
⍝ ---- Start Test cases (do not delete this!)
20100829 ≡ JoinDate 2010 8 29 1 2 3 4
10203 ≡ JoinDate 1 2 3 4
10203 10001231 19990102 ≡ JoinDate ⊃(1 2 3 4) (1000 12 31) (1999 1 2)
20100829 9990102 30000101 30001231≡100⊥3↑[⎕IO]⍉⊃(2010 8 29 112)(999 1 2 0)(3000 1 1 0)(3000 12 31 0)
0 ≡ JoinDate 0 0 0
0 ≡ JoinDate ⍳0

For details see the PhraseBook/TestCasesGuidelines.

Test my code, both Examples and Test Cases.

See also: SplitDate

Mentor: KaiJaeger

Tags: <TransformDate> <DateAsInt>


CategoryPhrasesAll - CategoryPhraseDates

PhraseBook/JoinDate (last edited 2011-12-26 10:35:16 by KaiJaeger)