Php determines whether the current time is a working day?

php determines whether the current time is a working day? How to implement
in code? Please give your advice

Thank you very much for your advice, but my demand is working days, not Monday to Friday, except national holidays and weekends

Mar.05,2021

Update according to the problem

take it away.
HolidayApi

=

read more documents

clipboard.png

$time = time();
$w = date('w',$time);
if($w != 0 and $w != 6)
{
    echo '';
}
else
{
    echo '';
}

weekday Monday, this is the day of the week

getdate()

// 
Array (
    [seconds] => 55 
    [minutes] => 9 
    [hours] => 18 
    [mday] => 23 
    [wday] => 1 
    [mon] => 4 
    [year] => 2018 
    [yday] => 112 
    [weekday] => Monday 
    [month] => April 
    [0] => 1524478195
)

"apart from national holidays and weekend working days", sometimes going to work on weekends is a working day, right?
does not know your specific usage scenarios. You can refer to the following. The validity of the code has not been verified, but for reference only
because the national holidays change every year. So use the API interface to determine that it is necessary
https://www.aspirantzhang.com.


I ask the operator to manually enter the annual holiday and then match it
the annual holiday is handed over to the operation and maintenance


$dt = Carbon::now ();
$dt- > isWeekday ();
$dt- > isWeekend ();

http://carbon.nesbot.com/docs/


echo date('w');  //;0,123456

several people upstairs may have misunderstood. The problem of the landlord is not isWeekday (which can be achieved by built-in date library), but to determine whether a certain day is a working day other than a legal holiday. For example, if you develop a program about the stock market, you need to know whether the market will be closed or open one day.
since many legal holidays are man-made and random and unpredictable for the code, I think we must import some hard-coded calendar to judge in advance, or through some third-party api to determine.


PHP can't know when you rest and go to work. To judge your working day, please call a third party API


apijson```
$time = time();
$w = date('w',$time);
.
Menu