Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8331

Re: creation of date list

From James Stein <mathgroup@stein.org>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: creation of date list
Date 2012-02-04 11:32 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jgj50b$n04$1@smc.vnet.net> (permalink)
References <201202030712.CAA12063@smc.vnet.net>

Show all headers | View raw


This may get you started:

(* date bounds: (adjust to suit) *)
d1={1920,1,8};
d2={1920,1,12};

(* f puts a date into (nearly) the format you want (no leading zeros) *)
f[d_]:=Apply[StringJoin,Riffle[RotateLeft[Map[ToString[#]&,d]],"/"]];

(* g makes a list of dates, formatted by g *)
g[d1_,d2_]:=Map[f[#]&,Table[DatePlus[d1,k],{k,0,DateDifference[d1,d2],1}]];

(* makes your list: *)
dates[d1,d2]

-- James



On Thu, Feb 2, 2012 at 11:12 PM, shippee <slshippee@gmail.com> wrote:

> I need to create a list of dates which runs from:
>
> 01/02/1901
> 01/03/1901
> 01/04/1901
> ...
> 12/11/1991
> 12/12/1991
> 12/13/1991
>
> but end up with a list of all those dates without the forward slash
> "/" - any thoughts on the best way to approach this with Mathematica?
> Please & Thanks in advance.
>
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: creation of date list James Stein <mathgroup@stein.org> - 2012-02-04 11:32 +0000

csiph-web