有Haskell资料库吗? [英] Is there a Haskell library for dates?

查看:60
本文介绍了有Haskell资料库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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?

推荐答案

Data.Time.Calendar Data.Time.Format 时间库是否足够?

您可以使用 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资料库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆