File: application/modules/extensions/aws/Aws/Api/DateTimeResult.php

Recommend this page to a friend!
  Classes of Tran Tuan  >  Pretty PHP S3 Files Manager  >  application/modules/extensions/aws/Aws/Api/DateTimeResult.php  >  Download  
File: application/modules/extensions/aws/Aws/Api/DateTimeResult.php
Role: Application script
Content type: text/plain
Description: Application script
Class: Pretty PHP S3 Files Manager
Web based interface to manage files in Amazon S3
Author: By
Last change:
Date: 4 years ago
Size: 883 bytes
 

Contents

Class file image Download
<?php
namespace Aws\Api;

/**
 * DateTime overrides that make DateTime work more seamlessly as a string,
 * with JSON documents, and with JMESPath.
 */
class DateTimeResult extends \DateTime implements \JsonSerializable
{
   
/**
     * Create a new DateTimeResult from a unix timestamp.
     *
     * @param $unixTimestamp
     *
     * @return DateTimeResult
     */
   
public static function fromEpoch($unixTimestamp)
    {
        return new
self(gmdate('c', $unixTimestamp));
    }

   
/**
     * Serialize the DateTimeResult as an ISO 8601 date string.
     *
     * @return string
     */
   
public function __toString()
    {
        return
$this->format('c');
    }

   
/**
     * Serialize the date as an ISO 8601 date when serializing as JSON.
     *
     * @return mixed|string
     */
   
public function jsonSerialize()
    {
        return (string)
$this;
    }
}


For more information send a message to info at phpclasses dot org.