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


Groups > comp.soft-sys.math.mathematica > #8319 > unrolled thread

creation of date list

Started byshippee <slshippee@gmail.com>
First post2012-02-03 07:14 +0000
Last post2012-02-13 08:42 +0000
Articles 5 — 5 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  creation of date list shippee <slshippee@gmail.com> - 2012-02-03 07:14 +0000
    Re: creation of date list "Nasser M. Abbasi" <nma@12000.org> - 2012-02-04 11:33 +0000
    Re: creation of date list Ray Koopman <koopman@sfu.ca> - 2012-02-04 11:39 +0000
    Re: creation of date list A Retey <awnl@gmx-topmail.de> - 2012-02-05 11:02 +0000
      Re: creation of date list Murta <rodrigomurtax@gmail.com> - 2012-02-13 08:42 +0000

#8319 — creation of date list

Fromshippee <slshippee@gmail.com>
Date2012-02-03 07:14 +0000
Subjectcreation of date list
Message-ID<jgg1gp$bpp$1@smc.vnet.net>
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.

[toc] | [next] | [standalone]


#8334

From"Nasser M. Abbasi" <nma@12000.org>
Date2012-02-04 11:33 +0000
Message-ID<jgj528$n11$1@smc.vnet.net>
In reply to#8319
On 2/3/2012 1:14 AM, shippee 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.
>
>

Not sure if I understood you, but here we go:

-----------------------------------------------
data = {"01/02/1901", "01/03/1901", "01/04/1901"};
StringJoin[StringCases[#, RegularExpression["[0-9]"]]] & /@ data
-----------------------------------------------

{"01021901", "01031901", "01041901"}

--Nasser




[toc] | [prev] | [next] | [standalone]


#8346

FromRay Koopman <koopman@sfu.ca>
Date2012-02-04 11:39 +0000
Message-ID<jgj5dn$n52$1@smc.vnet.net>
In reply to#8319
On Feb 2, 11:14 pm, shippee <slship...@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.

StringTake["0"<>ToString@#,-8]& /@ (DaysPlus[{1901,1,2},#]& /@
Range[0,DateDifference[{1901,1,2},{1991,12,13}],563].{1,1*^6,1*^4})

{"01021901","07191902","02021904","08181905","03041907","09171908",
 "04031910","10181911","05031913","11171914","06021916","12171917",
 "07031919","01161921","08021922","02161924","09011925","03181927",
 "10011928","04171930","11011931","05171933","12011934","06161936",
 "12311937","07171939","01301941","08161942","03011944","09151945",
 "04011947","10151948","05011950","11151951","05311953","12151954",
 "06301956","01141958","07311959","02131961","08301962","03151964",
 "09291965","04151967","10291968","05151970","11291971","06141973",
 "12291974","07141976","01281978","08141979","02271981","09131982",
 "03291984","10131985","04291987","11121988","05291990","12131991"}

To get all the days, delete the ",563" in the code.

[toc] | [prev] | [next] | [standalone]


#8349

FromA Retey <awnl@gmx-topmail.de>
Date2012-02-05 11:02 +0000
Message-ID<jglnk0$2bf$1@smc.vnet.net>
In reply to#8319
Am 03.02.2012 08:14, schrieb shippee:
> 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.

I think you didn't manage to make clear which direction you actually 
want to go. Here are possibilities for either way:

list1 = StringSplit["01/02/1901
01/03/1901
01/04/1901
12/11/1991
12/12/1991
12/13/1991", "\n"]

list2 = StringReplace[list1, "/" -> ""]

list3 = StringReplace[list2,
   RegularExpression["([0-9]{2})([0-9]{2})([0-9]{4})"] -> "$1/$2/$3"]

hth,

albert

[toc] | [prev] | [next] | [standalone]


#8509

FromMurta <rodrigomurtax@gmail.com>
Date2012-02-13 08:42 +0000
Message-ID<jhaid0$538$1@smc.vnet.net>
In reply to#8349
Hi...
There is another solution

DateString[#, {"Month", "/", "Day", "/", "Year"}] & /@
NestList[DatePlus[#, 1] &, "19010101", 364]

[]'s
Murta

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web