예제 #1
0
    $dateButton[$i]->tag = '';
    $dateButton[$i]->title = '.';
}
// set date to yyyy-mm-dd
if ($theDay == '') {
    //		$theDay                     = nuDateFormat(Today(),$returnDateFormat);
    $theDay = nuDateFormat(Today(), $returnDateFormat6);
    //tofile("theDay  $theDay");
}
$splitDate = array();
$splitDate = explode('-', $theDay);
if (monthNumber($splitDate[0]) != '') {
    $splitDate[0] = monthNumber($splitDate[0]);
}
if (monthNumber($splitDate[1]) != '') {
    $splitDate[1] = monthNumber($splitDate[1]);
}
if ($dayFirst) {
    $theDay = $splitDate[2] . '-' . $splitDate[1] . '-' . $splitDate[0];
} else {
    //--month first
    $theDay = $splitDate[2] . '-' . $splitDate[0] . '-' . $splitDate[1];
}
$thisMonth = nuDateFormat($theDay, 'm');
$thisYear = nuDateFormat($theDay, 'Y');
$firstOfTheMonth = nuDateAddDays("{$thisYear}-{$thisMonth}-01", 0);
$nextDate = $firstOfTheMonth;
for ($i = nuDateFormat($firstOfTheMonth, 'w'); $i < 42; $i++) {
    if (nuDateFormat($firstOfTheMonth, 'm') == nuDateFormat($nextDate, 'm')) {
        $dateButton[$i]->tag = nuDateFormat(nuDateAddDays($nextDate, 0), $returnDateFormat);
        $dateButton[$i]->title = nuDateFormat($nextDate, 'd');
예제 #2
0
function mysql_date($pdate)
{
    //---------creates a date string eg. '2004-10-25' from a formatted javascript date eg '25-Oct-2004', with single quotes that can go into mysql
    $pdate = iif(strlen($pdate) == 10, '0' . $pdate, $pdate);
    $newmth = '01';
    $mth = $pdate[3] . $pdate[4] . $pdate[5];
    if ($mth == 'Jan') {
        $newmth = '01';
    }
    if ($mth == 'Feb') {
        $newmth = '02';
    }
    if ($mth == 'Mar') {
        $newmth = '03';
    }
    if ($mth == 'Apr') {
        $newmth = '04';
    }
    if ($mth == 'May') {
        $newmth = '05';
    }
    if ($mth == 'Jun') {
        $newmth = '06';
    }
    if ($mth == 'Jul') {
        $newmth = '07';
    }
    if ($mth == 'Aug') {
        $newmth = '08';
    }
    if ($mth == 'Sep') {
        $newmth = '09';
    }
    if ($mth == 'Oct') {
        $newmth = '10';
    }
    if ($mth == 'Nov') {
        $newmth = '11';
    }
    if ($mth == 'Dec') {
        $newmth = '12';
    }
    return "'" . $pdate[7] . $pdate[8] . $pdate[9] . $pdate[10] . $pdate[6] . monthNumber($mth) . $pdate[6] . $pdate[0] . $pdate[1] . "'";
}