Re: [Haskell-cafe] string to date?
Quoth Magnus Therning, nevermore, I've been staring my eyes out trying to find a function that converts a string into a ClockTime or CalendarTime. Basically something like C's strptime(3). I can't seem to find anything like it in System.Time, there are function that convert _to_ a string, but nothing that converts _from_ a string it seems. Where should I look? The MissingH.Time.ParseDate [1] module might be what you want. There's also one from Bjorn Bringert [2]. I haven't used either though, so I can't recommend anything between them. Cheers, D. [1]: http://quux.org:70/devel/missingh/html/MissingH-Time-ParseDate.html [2]: http://www.cs.chalmers.se/~bringert/darcs/parsedate/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] string to date?
Magnus Therning [EMAIL PROTECTED] wrote: I've been staring my eyes out trying to find a function that converts a string into a ClockTime or CalendarTime. Basically something like C's strptime(3). I can't seem to find anything like it in System.Time, there are function that convert _to_ a string, but nothing that converts _from_ a string it seems. Where should I look? Not quite what you want, but: read? (opposite of show) Regards, Malcolm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] string to date?
Dougal Stanton wrote: Quoth Magnus Therning, nevermore, I've been staring my eyes out trying to find a function that converts a string into a ClockTime or CalendarTime. Basically something like C's strptime(3). I can't seem to find anything like it in System.Time, there are function that convert _to_ a string, but nothing that converts _from_ a string it seems. Where should I look? The MissingH.Time.ParseDate [1] module might be what you want. There's also one from Bjorn Bringert [2]. I haven't used either though, so I can't recommend anything between them. Cheers, D. [1]: http://quux.org:70/devel/missingh/html/MissingH-Time-ParseDate.html [2]: http://www.cs.chalmers.se/~bringert/darcs/parsedate/ Those two are the same code. I have a preliminary new version which can also parse most of the types from the time package (Data.Time.*) available at: http://www.cs.chalmers.se/~bringert/darcs/parsedate-2/ /Björn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] string to date?
On Thu, Nov 09, 2006 at 20:43:36 +0100, Björn Bringert wrote: Dougal Stanton wrote: Quoth Magnus Therning, nevermore, I've been staring my eyes out trying to find a function that converts a string into a ClockTime or CalendarTime. Basically something like C's strptime(3). I can't seem to find anything like it in System.Time, there are function that convert _to_ a string, but nothing that converts _from_ a string it seems. Where should I look? The MissingH.Time.ParseDate [1] module might be what you want. There's also one from Bjorn Bringert [2]. I haven't used either though, so I can't recommend anything between them. Cheers, D. [1]: http://quux.org:70/devel/missingh/html/MissingH-Time-ParseDate.html [2]: http://www.cs.chalmers.se/~bringert/darcs/parsedate/ Those two are the same code. I have a preliminary new version which can also parse most of the types from the time package (Data.Time.*) available at: http://www.cs.chalmers.se/~bringert/darcs/parsedate-2/ I noticed one thing when playing around with ParseDate.parseCalendarTime in ghci: parseCalendarTime System.Locale.defaultTimeLocale %Y 2006 Just (CalendarTime {ctYear = 2006, ctMonth = January, ctDay = 1, ctHour = 0, ctMin = 0, ctSec = 0, ctPicosec = 0, ctWDay = Thursday, ctYDay = 1, ctTZName = UTC, ctTZ = 0, ctIsDST = False}) parseCalendarTime System.Locale.defaultTimeLocale %Y%m%d 20061109 Nothing parseCalendarTime System.Locale.defaultTimeLocale %C%y%m%d 20061109 Just (CalendarTime {ctYear = 2006, ctMonth = November, ctDay = 9, ctHour = 0, ctMin = 0, ctSec = 0, ctPicosec = 0, ctWDay = Thursday, ctYDay = 1, ctTZName = UTC, ctTZ = 0, ctIsDST = False}) I'm on a Debian Sid system: % dpkg -l \*missingh\* Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name VersionDescription +++-=-==-== ii libghc6-hdbc-missingh-dev 1.0.1.1Integration of HDBC with MissingH, GHC version ii libghc6-missingh-dev 0.16.2 Library of utility functions for Haskell, GHC6 un missingh-doc none (no description available) /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) [EMAIL PROTECTED] Jabber: [EMAIL PROTECTED] http://therning.org/magnus Software is not manufactured, it is something you write and publish. Keep Europe free from software patents, we do not want censorship by patent law on written works. It's important for a corporate leader to know the difference between what is actually illegal, and what people assume should be illegal. -- Bill Gates, in interview for The Register, 19th June 2006 pgpHs2dpfTMVg.pgp Description: PGP signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] string to date?
On 10 nov 2006, at 00.29, Magnus Therning wrote: On Thu, Nov 09, 2006 at 20:43:36 +0100, Björn Bringert wrote: Dougal Stanton wrote: Quoth Magnus Therning, nevermore, I've been staring my eyes out trying to find a function that converts a string into a ClockTime or CalendarTime. Basically something like C's strptime(3). I can't seem to find anything like it in System.Time, there are function that convert _to_ a string, but nothing that converts _from_ a string it seems. Where should I look? The MissingH.Time.ParseDate [1] module might be what you want. There's also one from Bjorn Bringert [2]. I haven't used either though, so I can't recommend anything between them. Cheers, D. [1]: http://quux.org:70/devel/missingh/html/MissingH-Time- ParseDate.html [2]: http://www.cs.chalmers.se/~bringert/darcs/parsedate/ Those two are the same code. I have a preliminary new version which can also parse most of the types from the time package (Data.Time.*) available at: http://www.cs.chalmers.se/~bringert/darcs/parsedate-2/ I noticed one thing when playing around with ParseDate.parseCalendarTime in ghci: parseCalendarTime System.Locale.defaultTimeLocale %Y 2006 Just (CalendarTime {ctYear = 2006, ctMonth = January, ctDay = 1, ctHour = 0, ctMin = 0, ctSec = 0, ctPicosec = 0, ctWDay = Thursday, ctYDay = 1, ctTZName = UTC, ctTZ = 0, ctIsDST = False}) parseCalendarTime System.Locale.defaultTimeLocale %Y%m%d 20061109 Nothing parseCalendarTime System.Locale.defaultTimeLocale %C%y%m%d 20061109 Just (CalendarTime {ctYear = 2006, ctMonth = November, ctDay = 9, ctHour = 0, ctMin = 0, ctSec = 0, ctPicosec = 0, ctWDay = Thursday, ctYDay = 1, ctTZName = UTC, ctTZ = 0, ctIsDST = False}) Hi Magnus, thanks for the bug report. I have fixed this now in the version of the library available from http://www.cs.chalmers.se/~bringert/darcs/parsedate/ I intend to retire that version, and instead switch to the new implementation available at http://www.cs.chalmers.se/~bringert/darcs/parsedate-2/ This supports both CalendarTime and the new much nicer Data.Time types. However, the implementation is still incomplete (about as complete as the old version I think). It is missing support for week date formats and the like, and there is no test suite or QuickCheck properties (and thus there are surely lots of bugs). By the way, if you want to be sure that I see your bug reports about any of the libraries I maintain, please to cc the reports to me, or send them to me directly. /Björn___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe