[Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-05 Thread Offray Vladimir Luna Cárdenas
Hi all, I'm making a small data scrapper[1] in pharo to feed some visualizations. The data I'm scrapping contains strings with dates in Spanish like '16:21 - 15 de jun. de 2011' and I would like to convert them to proper dates in Smalltalk. So I started prototyping an Small script at [2], but

Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-05 Thread Sven Van Caekenberghe
You could have a look at the ZTimestamp package (you can load it using the Configuration Browser, the repository is http://www.smalltalkhub.com/#!/~SvenVanCaekenberghe/Neo). It has a class ZTimestampFormat which currently formats & parses dates/times/timestamps in 4 languages "by example". You

Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-05 Thread Ben Coman
On Mon, Apr 6, 2015 at 12:18 AM, Offray Vladimir Luna Cárdenas < off...@riseup.net> wrote: > Hi all, > > I'm making a small data scrapper[1] in pharo to feed some visualizations. > The data I'm scrapping contains strings with dates in Spanish like '16:21 - > 15 de jun. de 2011' and I would like to

Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-05 Thread Offray Vladimir Luna Cárdenas
Thanks Ben and Sven, I will take a look to both of your suggestions. Cheers, Offray El 05/04/15 a las 12:28, Ben Coman escribió: On Mon, Apr 6, 2015 at 12:18 AM, Offray Vladimir Luna Cárdenas mailto:off...@riseup.net>> wrote: Hi all, I'm making a small data scrapper[1] in pharo

Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-05 Thread Paul DeBruicker
copyFrom:14 to: 17 copies 4 characters. You're testing a 4 character long string against a 3 character long string. That's why the test fails. Either change it to copyFrom: 15 to:17 or add a trimBoth send to month temp var. You may have an easier time not using temp variables in the worksp

Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-06 Thread Offray Vladimir Luna Cárdenas
Thanks Paul, My bad! Rookie mistake :-). Now is working as implemented in [1] and updated in the Dataviz-Twitter package. [1] http://ws.stfx.eu/L4PZMLV88I8U Thanks, Offray El 05/04/15 a las 22:22, Paul DeBruicker escribió: copyFrom:14 to: 17 copies 4 characters. You're testing a 4 charact

Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-06 Thread Offray Vladimir Luna Cárdenas
Well... there is still a minor issue with the hour... is not part of the date, for some reason. Cheers, Offray El 06/04/15 a las 14:15, Offray Vladimir Luna Cárdenas escribió: Thanks Paul, My bad! Rookie mistake :-). Now is working as implemented in [1] and updated in the Dataviz-Twitter pac

Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-06 Thread Paul DeBruicker
When you look at the Date class comment you'll see that they are timespans (a Start + a duration ) and not moments in time, like the time on a clock on a certain day. What you want is probably an instance of DateAndTime. Offray wrote > Well... there is still a minor issue with the hour... i

Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-06 Thread Offray Vladimir Luna Cárdenas
Yep, that was it. asDateAndTime solves the issue. Thanks, Offray El 06/04/15 a las 14:37, Paul DeBruicker escribió: When you look at the Date class comment you'll see that they are timespans (a Start + a duration ) and not moments in time, like the time on a clock on a certain day. What you w