src/Util/Caliper.php
public static function getISO8601($timestamp=false) {
        if ( $timestamp === false ) {
            $dt = new \DateTime();
        } else {
            $format = 'Y-m-d H:i:s';
            $dt = \DateTime::createFromFormat($format, $timestamp);
        }

        // 2017-08-16T16:26:31-1000
        $iso8601 = $dt->format(\DateTime::ISO8601);

        // 2017-08-20T10:34:05.000Z
        $iso8601 = str_replace('-1000','.000Z',$iso8601);

        return $iso8601;
    }
public static function getISO8601($timestamp=false) {
        if ( $timestamp === false ) {
            $dt = new \DateTime();
        } else {
            $format = 'Y-m-d H:i:s';
            $dt = \DateTime::createFromFormat($format, $timestamp);
        }

        // 2017-08-16T16:26:31-1000
        $iso8601 = $dt->format(\DateTime::ISO8601);

        // 2017-08-20T10:34:05.000Z
        $iso8601 = str_replace('-1000','.000Z',$iso8601);

        return $iso8601;
    }
public static function getISO8601 ( $ timestamp = false ) { if ( $ timestamp === false ) { $ dt = new \ DateTime ( ) ; } else { $ format = 'Y-m-d H:i:s' ; $ dt = \ DateTime :: createFromFormat ( $ format , $ timestamp ) ; } // 2017-08-16T16:26:31-1000 $ iso8601 = $ dt -> format ( \ DateTime :: ISO8601 ) ; // 2017-08-20T10:34:05.000Z $ iso8601 = str_replace ( '-1000' , '.000Z' , $ iso8601 ) ; return $ iso8601 ; }
Get Caliper-style ISO8601 Datetime from unix timestamp
Get Caliper - style ISO8601 Datetime from unix timestamp