开发者

PHP how to check if a day was a holiday (in a specified country)?

开发者 https://www.devze.com 2023-02-06 00:43 出处:网络
Is there some function that would tell me if a date was a holiday in a certain country? I know this is probably futile question as it would be difficult to have a function lik开发者_运维问答e that.I

Is there some function that would tell me if a date was a holiday in a certain country?

I know this is probably futile question as it would be difficult to have a function lik开发者_运维问答e that.


I might be wrong, but I think you are going to have to roll your own. And even if there is already a lib that does this for you, you are going to have to be careful - the definition of holiday will vary, even for a given country. (E.g does a religious holiday mean the banks are shut?). I.e what constitutes a holiday is likely to be application dependent. Take a look at this wikipedia page for lists of national holidays: http://en.wikipedia.org/wiki/List_of_holidays_by_country


There is no built-in function for this, but you might be able to roll-your-own using the holiday script at AbleDesign as the base


Rather late in posting an answer, but as the current maintainer of the relevant PEAR Packages, I would suggest that you utilise the Date Holidays suite of components from PEAR. There are drivers for most countries: Australia, USA, UK, Germany, Russia and others.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号