简体   繁体   English

确定生成日期是否属于假日(PHP)?

[英]Determine if generated date falls on a holiday (PHP)?

Does anyone know of an existing library or even a useful function that would allow a php script to check if a generated date clashes with a holiday, whether it be US, UK, AUS, or SAF holidays? 有没有人知道现有的库,甚至是一个有用的函数,它允许php脚本检查生成的日期是否与假日冲突,无论是美国,英国,澳大利亚还是SAF假期?

If there is no library are there any useful sources online which I could harness to develop my own? 如果没有图书馆,网上是否有任何有用的资源我可以利用它来开发自己的资源?

I just google about this because this is interesting subject and i havn't tried it but it seems possible using pear package. 我只是谷歌这个,因为这是一个有趣的主题,我没有尝试过,但似乎可以使用梨包。

Here is link : http://pear.php.net/package/Date_Holidays 这是链接: http//pear.php.net/package/Date_Holidays

Here is example: http://pear.php.net/manual/en/package.datetime.date-holidays.example.php 这是一个例子: http//pear.php.net/manual/en/package.datetime.date-holidays.example.php

Hope this helpful to you 希望这对你有所帮助

I found this useful package this morning: 今天早上我找到了这个有用的包:

http://maccrafters.com/home/current-offerings/programming/php-holiday-class/ http://maccrafters.com/home/current-offerings/programming/php-holiday-class/

It is pretty easy to adapt it and make it more powerful, but it is very user friendly and works well so far. 它很容易适应它并使其更强大,但它非常用户友好,并且到目前为止运行良好。 It also has a nice feature for getting the next business day from a particular date. 它还具有从特定日期开始下一个工作日的好功能。

Some option can be: Michalmanko/Holiday is a small library to check if a specified date is a holiday in a specific country. 一些选项可以是:Michalmanko / Holiday是一个小型图书馆,用于检查指定日期是否是特定国家/地区的假日。 https://github.com/michalmanko/php-library-holiday https://github.com/michalmanko/php-library-holiday

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM