예제 #1
0
function getLastMonth_FromToDates()
{
    $tmp_thisyear = date("Y");
    $tmp_today = date("d");
    $tmp_thismonth = date("m");
    if ($tmp_thismonth == "01") {
        $tmp_lastyear = $tmp_thisyear - 1;
        $lastmonth_fromdate = $tmp_lastyear . "-12-01";
        $lastmonth_todate = $tmp_lastyear . "-12-31";
    } else {
        $tmp_lastmonth = $tmp_thismonth - 1;
        $lastmonth_fromdate = $tmp_thisyear . "-" . addZeroToNumber($tmp_lastmonth) . "-01";
        $lastmonth_todate = $tmp_thisyear . "-" . addZeroToNumber($tmp_lastmonth) . "-31";
    }
    return array($lastmonth_fromdate, $lastmonth_todate);
}
예제 #2
0
function caldateTS_to_icalDate($caldateTS, $second = false)
{
    //// $caldateTS = 'YYYY-mm-dd hr:m:s' returns 20091028T143000Z
    if (!$caldateTS) {
        return '';
    }
    $pieces = explode(" ", $caldateTS);
    $tmp_datepart = $pieces[0];
    $tmp_timepart = $pieces[1];
    $ymd = implode('', explode("-", $tmp_datepart));
    if (!$second) {
        $hms = implode('', explode(":", $tmp_timepart));
    } else {
        $hms = explode(":", $tmp_timepart);
        $hms[2] = (int) $hms[2];
        $hms[2]++;
        $hms[2] = addZeroToNumber($hms[2]);
        $hms = implode('', $hms);
    }
    return $ymd . 'T' . $hms;
}