[Pharo-project] Does anyone have tried/succeeded to use PetitParser for parsing dates?
I wonder if anyone has used PetitParser to parse dates in diverse formats. e.g 01/01/2012 07/31/2012 And with failures on things like 2012-07-32 or 2012-13-01 or 2012-02-30 or 2011-02-29 Regards Friedrich -- Q-Software Solutions GmbH; Sitz: Bruchsal; Registergericht: Mannheim Registriernummer: HRB232138; Geschaeftsfuehrer: Friedrich Dominicus
Hi, I used it for various forms of dates. What is the question? Cheers, Doru On 14 Mar 2012, at 16:24, Friedrich Dominicus wrote:
I wonder if anyone has used PetitParser to parse dates in diverse formats. e.g 01/01/2012 07/31/2012
And with failures on things like 2012-07-32 or 2012-13-01 or 2012-02-30 or 2011-02-29
Regards Friedrich
-- Q-Software Solutions GmbH; Sitz: Bruchsal; Registergericht: Mannheim Registriernummer: HRB232138; Geschaeftsfuehrer: Friedrich Dominicus
-- www.tudorgirba.com "One cannot do more than one can do."
Tudor Girba <tudor@tudorgirba.com> writes:
Hi,
I used it for various forms of dates. What is the question? E.g handling of optional leading zeroes
how did you handle things like 1/1/11 (or didn't you?) or worse 1/1/1 -> 01.01.2001? how have you treated dates like 1/12/2012 -> 12.01.2012 or 1.12.2012? or even more "problematic" 12/12/2012 and the like there are so many way to parse the dates.... Regards Friedrich -- Q-Software Solutions GmbH; Sitz: Bruchsal; Registergericht: Mannheim Registriernummer: HRB232138; Geschaeftsfuehrer: Friedrich Dominicus
how did you handle things like 1/1/11 (or didn't you?) or worse 1/1/1 -> 01.01.2001? This is not related to parsing but to the interpretation of the data :)
There is no magic no? BTW this is the birthday of one of my sons :)
how have you treated dates like 1/12/2012 -> 12.01.2012 or 1.12.2012?
or even more "problematic" 12/12/2012
Again why a computer looking at only one sample would be prescient?
and the like there are so many way to parse the dates....
Regards Friedrich
-- Q-Software Solutions GmbH; Sitz: Bruchsal; Registergericht: Mannheim Registriernummer: HRB232138; Geschaeftsfuehrer: Friedrich Dominicus
2012/3/16 Stéphane Ducasse <stephane.ducasse@inria.fr>
how did you handle things like 1/1/11 (or didn't you?) or worse 1/1/1 -> 01.01.2001? This is not related to parsing but to the interpretation of the data :)
I agree with Stef, your seems to be more an interpretation problem. If you are looking for a parser that can parse any kind of datas you can write something like:
#digit asParser plus flatten separatedBy: ('/' asParser / '.' asParser) But to know what you reading you should have some convention to follow. Cheers, Fabrizio There is no magic no?
BTW this is the birthday of one of my sons :)
how have you treated dates like 1/12/2012 -> 12.01.2012 or 1.12.2012?
or even more "problematic" 12/12/2012
Again why a computer looking at only one sample would be prescient?
and the like there are so many way to parse the dates....
Regards Friedrich
-- Q-Software Solutions GmbH; Sitz: Bruchsal; Registergericht: Mannheim Registriernummer: HRB232138; Geschaeftsfuehrer: Friedrich Dominicus
participants (4)
-
Fabrizio Perin -
Friedrich Dominicus -
Stéphane Ducasse -
Tudor Girba