问题描述
Haskell中是否有一个函数,可以让我输入可以从中获取信息的日期部分(例如字符串表示形式或星期,月份,年份,年份等),例如星期几,一个月中的某天等等。 ?
Is there a function in Haskell that will allow me to enter component of a date (like a string representation or day month year components) that I can get information from (like day of week, days in a month, etc.)?
我在网上看过,似乎有很多自定义库,但是我希望ghci 10.6.4的标准前奏库中有一个
I've looked online and it looks like there are a lot of custom libraries, but I'm hoping there's one in the standard prelude library of ghci 10.6.4 that's just not well documented?
推荐答案
是和在是否足够?
您可以使用 gregorianMonthLength
解析日期的字符串表示形式并获得一个月的长度。尽管可以使用仅显示星期几的格式将日期格式化为字符串,但不能确定星期几。
You can parse a string representation of a date and get the length of a month using gregorianMonthLength
. Not sure about day of the week, though you could format the date as a string using a format that just displays the week day.
这篇关于有Haskell资料库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!