[Haskell-cafe] Converting string to System.Time.ClockTime

2011-12-08 Thread dokondr
Hi, What would be the simplest way to convert strings like Wed, 07 Dec 2011 10:09:21 + to System.Time.ClockTime ? Thanks! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Converting string to System.Time.ClockTime

2011-12-08 Thread Erik Hesselink
I'm not sure if you really need ClockTime (from old-time), but if you don't, the types from the 'time' package are all parseable with `parseTime` [1]. Erik [1] http://hackage.haskell.org/packages/archive/time/latest/doc/html/Data-Time-Format.html#v:parseTime On Thu, Dec 8, 2011 at 14:16,

Re: [Haskell-cafe] Converting string to System.Time.ClockTime

2011-12-08 Thread dokondr
I need to parse time strings like Wed, 07 Dec 2011 10:09:21 + to a type that: 1) implements Eq, Ord 2) is numerical, so I could subtract one value from another to find the difference or interval length To answer 1) requirement I wrote the following snippet. Yet I could not subtract UTCTime

Re: [Haskell-cafe] Converting string to System.Time.ClockTime

2011-12-08 Thread dokondr
Now, when I have managed to convert UTCTime to seconds (see code below) I got stuck trying to convert from UTCTime to CalendarTime, how to do this? import Data.Time.Format import Data.Time.Clock import Locale import Data.Maybe import Data.Time.Clock.POSIX s1 = Wed, 07 Dec 2011 10:09:21 + s2

Re: [Haskell-cafe] Converting string to System.Time.ClockTime

2011-12-08 Thread Antoine Latter
On Thu, Dec 8, 2011 at 9:01 AM, dokondr doko...@gmail.com wrote: Now, when I have managed to convert UTCTime to seconds (see code below) I got stuck trying to convert from UTCTime to CalendarTime, how to do this? It might be easier to use 'diffUTCTime' and 'addUTCTime' instead of converting

Re: [Haskell-cafe] Converting string to System.Time.ClockTime

2011-12-08 Thread Antoine Latter
On Thu, Dec 8, 2011 at 9:13 AM, Antoine Latter aslat...@gmail.com wrote: On Thu, Dec 8, 2011 at 9:01 AM, dokondr doko...@gmail.com wrote: Now, when I have managed to convert UTCTime to seconds (see code below) I got stuck trying to convert from UTCTime to CalendarTime, how to do this? It

Re: [Haskell-cafe] Converting string to System.Time.ClockTime

2011-12-08 Thread dokondr
Ok, maybe you could advise what packages to use for this simple scenario: I have two text strings with dates: s1 = Wed, 07 Dec 2011 10:09:21 + s2 = Wed, 07 Dec 2011 10:11:00 + I need: 1) Find how many seconds are between these dates 2) Calculate the date in the middle between these

Re: [Haskell-cafe] Converting string to System.Time.ClockTime

2011-12-08 Thread Antoine Latter
On Thu, Dec 8, 2011 at 9:30 AM, dokondr doko...@gmail.com wrote: Ok, maybe you could advise what packages to use for this simple scenario: I have two text strings with dates: s1 = Wed, 07 Dec 2011 10:09:21 + s2 = Wed, 07 Dec 2011 10:11:00 + I need: 1) Find how many seconds are

Re: [Haskell-cafe] Converting string to System.Time.ClockTime

2011-12-08 Thread dokondr
On Thu, Dec 8, 2011 at 7:39 PM, Antoine Latter aslat...@gmail.com wrote: On Thu, Dec 8, 2011 at 9:30 AM, dokondr doko...@gmail.com wrote: Ok, maybe you could advise what packages to use for this simple scenario: I have two text strings with dates: s1 = Wed, 07 Dec 2011 10:09:21 +