tz_disabled=true; $ec3->tz=getenv('TZ'); else: // PHP4 safe mode OFF function ec3_tz_push($tz) { $old_tz=getenv('TZ'); putenv("TZ=$tz"); return $old_tz; } function ec3_tz_pop($tz) { putenv("TZ=$tz"); } endif; /** Converts a WordPress timestamp (string in local time) to Unix time. */ function ec3_to_time($timestamp) { global $ec3; // Parse $timestamp and extract the Unix time. $old_tz=ec3_tz_push($ec3->tz); $unix_time = strtotime($timestamp); ec3_tz_pop($old_tz); // Unix time is seconds since the epoch (in UTC). return $unix_time; } /** Converts a WordPress timestamp (string in local time) to * string in formatted UTC. */ function ec3_to_utc($timestamp,$fmt='%Y%m%dT%H%M00Z') { $result = gmstrftime($fmt,ec3_to_time($timestamp)); return $result; } /** Formats a Unix time as a time in the current timezone. */ function ec3_strftime($format,$unix_time=0) { global $ec3; if(!$unix_time) $unix_time=time(); // Express the Unix time as a string for timezone $ec3->tz. $old_tz=ec3_tz_push($ec3->tz); $result = strftime($format,$unix_time); ec3_tz_pop($old_tz); return $result; } $ec3->today=ec3_strftime("%Y-%m-%d 00:00:00"); /** Call from within a