Hi, can someone help me, My server is in the uk, I'm in the States, I want the date of the calendar to show the current day EST, not advance when the server clock hits midnight, someone helped me but it didn't work out:
<?php
function calendar($date = '') {
Global $link_on_day, $PHP_SELF, $params;
Global $HTTP_POST_VARS, $HTTP_GET_VARS;
### Default Params
$param_d['calendar_id'] = 1; // Calendar ID
$param_d['calendar_columns'] = 7; // Nb of columns
$param_d['show_day'] = 1; // Show the day bar
$param_d['show_month'] = 1; // Show the month bar
$param_d['nav_link'] = 0; // Add a nav bar below
$param_d['link_after_date'] = 0; // Enable link on days after the current day
$param_d['link_on_day'] = $PHP_SELF.'?date='; // Link to put on each day
$param_d['font_face'] = 'Verdana, Arial, Helvetica'; // Default font to use
$param_d['font_size'] = 10; // Font size in px
$param_d['bg_color'] = '#EEEEEE';
$param_d['today_bg_color'] = '#D1D7E4';
$param_d['font_today_color'] = '#FFFFFF';
$param_d['font_color'] = '#000000';
$param_d['font_nav_bg_color'] = '#D1D7E4';
$param_d['font_nav_color'] = '#FFFFFF';
$param_d['font_header_color'] = '#FFFFFF';
$param_d['border_color'] = '#000000';
$param_d['use_img'] = 0; // Use gif for nav bar on the bottom
### /Params
$monthes_name = array('','January', 'Feburary', 'March',
'April', 'May', 'June', 'July',
'August', 'September', 'October',
'November', 'December'
);
while (list($key, $val) = each($param_d)) {
if (isset($params[$key])) {
$param[$key] = $params[$key];
}
else {
$param[$key] = $param_d[$key];
}
}
$param['calendar_columns'] = ($param['show_day']) ? 7 : $param['calendar_columns'];
$date = priv_reg_glob_calendar('date');
if ($date == '') {
$curtime = time();
$diff = 5;
$timestamp = $curtime - $diff;
}
else {
$month = substr($date, 4 ,2);
$day = substr($date, 6, 2);
$year = substr($date, 0 ,4);
$timestamp = mktime(0, 0, 0, $month, $day, $year);
}
$current_day = date("d", $timestamp);
$current_month = date('n', $timestamp);
$current_month_2 = date('m', $timestamp);
$current_year = date('Y', $timestamp);
$first_day_pos = date("w", mktime(1, 0, 0, $current_month, 1, $current_year));
$first_day_pos = ($first_day_pos == 0) ? 7 : $first_day_pos;
$current_month_name = $monthes_name[$current_month];
$nb_days_month = date("t", $timestamp);
$current_timestamp = mktime(23,59,59,date("m"), date("d"), date("Y"));
$output .= '<TABLE border="0" width="150" class="atable'.$param['calendar_id'].'" cellpadding="2" cellspacing="1">'."\n";
### Displaying the current month/year
if ($param['show_month'] == 1) {
$output .= '<TR>'."\n";
$output .= ' <TD colspan="'.$param['calendar_columns'].'" align="center" class="calendarTop'.$param['calendar_id'].'">'."\n";
### Insert an img at will
if ($param['use_img'] ) {
$output .= '<IMG src="mois.gif">';
}
$output .= ' '.$current_month_name.' '.$current_year."\n";
$output .= ' </TD>'."\n";
$output .= '</TR>'."\n";
}
### Building the table row with the days
if ($param['show_day'] == 1) {
$output .= '<TR align="center">'."\n";
$output .= ' <TD class="calendarHeader'.$param['calendar_id'].'"><B>S</B></TD>'."\n";
$output .= ' <TD class="calendarHeader'.$param['calendar_id'].'"><B>M</B></TD>'."\n";
$output .= ' <TD class="calendarHeader'.$param['calendar_id'].'"><B>T</B></TD>'."\n";
$output .= ' <TD class="calendarHeader'.$param['calendar_id'].'"><B>W</B></TD>'."\n";
$output .= ' <TD class="calendarHeader'.$param['calendar_id'].'"><B>T</B></TD>'."\n";
$output .= ' <TD class="calendarHeader'.$param['calendar_id'].'"><B>F</B></TD>'."\n";
$output .= ' <TD class="calendarHeader'.$param['calendar_id'].'"><B>S</B></TD>'."\n";
$output .= '</TR>'."\n";
}
else {
$first_day_pos = 1;
}
$output .= '<TR align="center">';
$int_counter = 0;
for ($i = 0; $i < $first_day_pos; $i++) {
$output .= '<TD class="calendarDays'.$param['calendar_id'].'"> </TD>'."\n";
$int_counter++;
}
### Building the table
for ($i = 1; $i <= $nb_days_month; $i++) {
$i_2 = ($i < 10) ? '0'.$i : $i;
### Row start
if ((($i + $first_day_pos-0) % $param['calendar_columns']) == 1 && $i != 1) {
$output .= '<TR align="center">'."\n";
$int_counter = 0;
}
if ($i == $current_day) {
$output .= '<TD class="calendarToday'.$param['calendar_id'].'" align="center">'.$i.'</TD>'."\n";
}
elseif ($param['link_on_day'] != '') {
$loop_timestamp = mktime(0,0,0, $current_month, $i, $current_year);
if ( ($param['link_after_date'] == 0) && ($current_timestamp < $loop_timestamp)) {
$output .= '<TD class="calendarDays'.$param['calendar_id'].'">'.$i.'</TD>'."\n";
}
else {
$output .= '<TD class="calendarDays'.$param['calendar_id'].'">'.$i.'</TD>'."\n";
}
}
else {
$output .= '<TD class="calendarDays'.$param['calendar_id'].'">'.$i.'</TD>'."\n";
}
$int_counter++;
### Row end
if ( (($i+$first_day_pos-0) % $param['calendar_columns']) == 0 ) {
$output .= '</TR>'."\n";
}
}
$cell_missing = $param['calendar_columns'] - $int_counter;
for ($i = 0; $i < $cell_missing; $i++) {
$output .= '<TD class="calendarDays'.$param['calendar_id'].'"> </TD>'."\n";
}
$output .= '</TR>'."\n";
}
$output .= '</TABLE>'."\n";
return $output;
}
function priv_reg_glob_calendar($var) {
Global $HTTP_GET_VARS, $HTTP_POST_VARS;
if (isset($HTTP_GET_VARS[$var])) {
return $HTTP_GET_VARS[$var];
}
elseif (isset($HTTP_POST_VARS[$var])) {
return $HTTP_POST_VARS[$var];
}
else {
return '';
}
}
?>