--- F:/WebServers/home/ms/www/modules/token/token_cck.inc Fri Feb 22 02:39:28 2008 +++ F:/WebServers/home/ms/www/modules/token/new_token_cck.inc Fri Feb 22 02:37:33 2008 @@ -251,50 +251,52 @@ function date_token_values($type, $object = NULL, $options = array()) { if ($type == 'field') { - include_once(drupal_get_path('module', 'date') .'/date.inc'); + $item = $object[0]; $item['value'] = trim($item['value']); $item_format = (is_numeric($item['value']) ? DATE_UNIX : DATE_ISO); - $date = date_make_date($item['value'], 'none', 'local', $item_format); + $timezone = $item['timezone'] ? $item['timezone'] : date_default_timezone_name(); + $date = date_make_date($item['value'], $timezone, $item_format); $tokens['value'] = $item['value']; $tokens['view'] = $item['view']; $tokens['timestamp'] = $date->local->timestamp; - $tokens['yyyy'] = date_show_date($date, 'Y'); - $tokens['yy'] = date_show_date($date, 'y'); - $tokens['month'] = date_show_date($date, 'F'); - $tokens['mon'] = date_show_date($date, 'M'); - $tokens['mm'] = date_show_date($date, 'm'); - $tokens['m'] = date_show_date($date, 'n'); - $tokens['ww'] = date_show_date($date, 'W'); - $tokens['date'] = date_show_date($date, 'N'); - $tokens['day'] = date_show_date($date, 'l'); - $tokens['ddd'] = date_show_date($date, 'D'); - $tokens['dd'] = date_show_date($date, 'd'); - $tokens['d'] = date_show_date($date, 'j'); + $tokens['yyyy'] = date_format_date($date, 'custom', 'Y'); + $tokens['yy'] = date_format_date($date, 'custom', 'y'); + $tokens['month'] = date_format_date($date, 'custom', 'F'); + $tokens['mon'] = date_format_date($date, 'custom', 'M'); + $tokens['mm'] = date_format_date($date, 'custom', 'm'); + $tokens['m'] = date_format_date($date, 'custom', 'n'); + $tokens['ww'] = date_format_date($date, 'custom', 'W'); + $tokens['date'] = date_format_date($date, 'custom', 'N'); + $tokens['day'] = date_format_date($date, 'custom', 'l'); + $tokens['ddd'] = date_format_date($date, 'custom', 'D'); + $tokens['dd'] = date_format_date($date, 'custom', 'd'); + $tokens['d'] = date_format_date($date, 'custom', 'j'); if (!empty($item['value2'])) { $item['value2'] = trim($item['value2']); $item_format = (is_numeric($item['value2']) ? DATE_UNIX : DATE_ISO); - $date = date_make_date($item['value2'], 'none', 'local', $item_format); + $timezone = $item['timezone'] ? $item['timezone'] : date_default_timezone_name(); + $date = date_make_date($item['value2'], $timezone, $item_format); $tokens['to-value'] = $item['value2']; $tokens['to-view'] = $item['view2']; $tokens['to-timestamp'] = $date->local->timestamp; - $tokens['to-yyyy'] = date_show_date($date, 'Y'); - $tokens['to-yy'] = date_show_date($date, 'y'); - $tokens['to-month'] = date_show_date($date, 'F'); - $tokens['to-mon'] = date_show_date($date, 'M'); - $tokens['to-mm'] = date_show_date($date, 'm'); - $tokens['to-m'] = date_show_date($date, 'n'); - $tokens['to-ww'] = date_show_date($date, 'W'); - $tokens['to-date'] = date_show_date($date, 'N'); - $tokens['to-day'] = date_show_date($date, 'l'); - $tokens['to-ddd'] = date_show_date($date, 'D'); - $tokens['to-dd'] = date_show_date($date, 'd'); - $tokens['to-d'] = date_show_date($date, 'j'); + $tokens['to-yyyy'] = date_format_date($date, 'custom', 'Y'); + $tokens['to-yy'] = date_format_date($date, 'custom', 'y'); + $tokens['to-month'] = date_format_date($date, 'custom', 'F'); + $tokens['to-mon'] = date_format_date($date, 'custom', 'M'); + $tokens['to-mm'] = date_format_date($date, 'custom', 'm'); + $tokens['to-m'] = date_format_date($date, 'custom', 'n'); + $tokens['to-ww'] = date_format_date($date, 'custom', 'W'); + $tokens['to-date'] = date_format_date($date, 'custom', 'N'); + $tokens['to-day'] = date_format_date($date, 'custom', 'l'); + $tokens['to-ddd'] = date_format_date($date, 'custom', 'D'); + $tokens['to-dd'] = date_format_date($date, 'custom', 'd'); + $tokens['to-d'] = date_format_date($date, 'custom', 'j'); } return $tokens; }