On Thu, Dec 8, 2011 at 9:30 AM, dokondr <[email protected]> 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 +0000" > s2 = "Wed, 07 Dec 2011 10:11:00 +0000" > > I need: > 1) Find how many seconds are between these dates > 2) Calculate the date in the middle between these dates
It looks like you already have 1) and 2) finished, using the 'time' package. > 3) Print out all three dates in the different format, like these: > 2011, 7 Dec, Wed, 10:11:00 If you need to convert into a specific time-zone you can use the 'utcToLocalTime' function in the 'time' package, which takes a UTCTime and a TimeZone to create a 'LocalTime'. I'm just guessing that you might want this, as your output format doesn't include time-zone information. Then for formatting, the 'Data.Time.Format' module in the 'time' package has the function 'formatTime', which uses the same sort of format string used by 'parseTime'. I hope that helps! It took me a while to find my way around the 'time' package properly. Antoine _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
