You are here

function cc::convert_timestamp in Constant Contact 7.3

Same name and namespace in other branches
  1. 6.3 class.cc.php \cc::convert_timestamp()
  2. 6.2 class.cc.php \cc::convert_timestamp()

Converts datetime from 2008-08-05T16:50:04.534Z format to UNIX timestamp.

@access public

File

./class.cc.php, line 1500
Constant Contact PHP Class

Class

cc
@file Constant Contact PHP Class

Code

function convert_timestamp($timestamp) {
  $timestamp_bits = explode('T', $timestamp);
  if (isset($timestamp_bits[0], $timestamp_bits[0])) {
    $date_bits = explode('-', $timestamp_bits[0]);
    $time_bits = explode(':', $timestamp_bits[1]);
    $year = $date_bits[0];
    $month = $date_bits[1];
    $day = $date_bits[2];
    $hour = $time_bits[0];
    $minute = $time_bits[1];
    $second = $time_bits[2];
    return mktime($hour, $minute, 0, $month, $day, $year);
  }
  return FALSE;
}