<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[aiuto con class e function]]></title><description><![CDATA[<p dir="auto">ciao ragazzi spero proprio ke mi possiate dare 1 mano..<br />
in una classe ho una funzione che calcola il numero di giorni lavorativi tra 2 date<br />
&lt;CODE&gt;<br />
function days_diff($p_start_date, $p_end_date = NULL, $p_workdays_only = TRUE, $p_skip_holidays = TRUE){</p>
<pre><code>//
//Function : Main function to calculate the number of days or work days between 2 dates. If no end date passed
//           in then this can be used to identify if the day is a working day as the function will return 1 or 0
//Params
//         : p_start_date     This paramter is the range starting date
//         : p_end_date       This paramter is the range ending date (can be null)
//         : p_workdays_only  This paramter is set if you DO NOT want to count weekends
//         : p_skip_holidays  This paramter is set if you DO NOT want to count standard Bank Holidays &amp; enforced business shutdowns
// Returns
//         : number of days between the 2 dates or if no end date passed in then 1/0 if the start day is a work day
//

    $end_date        = $p_end_date;
    if ( strlen($p_end_date)==0 ) $end_date = $p_start_date;

    $end_date        = strtotime($end_date);
    $start_date      = strtotime($p_start_date);
    $nbr_work_days   = 0;        
    for($day_val = $start_date; $day_val &lt;= $end_date; $day_val += $this-&gt;seconds_per_day){
        $pointer_day = date("w", $day_val);
        if($p_workdays_only == true){
            if(($pointer_day != $this-&gt;sunday_val) AND ($pointer_day != $this-&gt;saturday_val)){
                if($p_skip_holidays == true){
                    if(!in_array($day_val, $this-&gt;holiday_dates)){
                        $nbr_work_days++;
                    }
                }else{
                    $nbr_work_days++;
                }
            }
        }else{
            if($p_skip_holidays == true){
                if(!in_array($day_val, $this-&gt;holiday_dates)){
                    $nbr_work_days++;
                }
            }else{
                $nbr_work_days++;
            }
        }
    }
    return $nbr_work_days;
}
</code></pre>
<p dir="auto">&lt;/CODE&gt;<br />
sapete dirmi com'è la funzione per calcolare qual'è il giorno lavorativo dopo tot giorni???<br />
tipo l'utente inserisce un giorno lavorativo ad es lunedi 18 ago e vuole sapere che giorno sarà tra 15 giorni lavorativi (risposta venerdì 5 settembre cioè quello ke dovrebbe uscire in output)<br />
nn so se mi sono spiegato grazie in anticipo<img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/56d494eb-5ad3-4efa-88ab-614a4d779183-bigsmile.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--bigsmile" style="height:1.4em;width:auto;vertical-align:middle" title=":bigsmile:" alt="" /></p>
]]></description><link>https://dev.connect.gt/topic/80189/aiuto-con-class-e-function</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 20:06:32 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/80189.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 18 Aug 2008 14:07:58 GMT</pubDate><ttl>60</ttl></channel></rss>