mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-20 13:23:47 -07:00
spaces.php
This commit is contained in:
parent
7755490b81
commit
eefa32741e
845 changed files with 50409 additions and 0 deletions
41
aws/Aws/Api/DateTimeResult.php
Normal file
41
aws/Aws/Api/DateTimeResult.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue