当前位置: 首页>>代码示例>>PHP>>正文


PHP Utilities::convertToDateTime方法代码示例

本文整理汇总了PHP中WindowsAzure\Common\Internal\Utilities::convertToDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::convertToDateTime方法的具体用法?PHP Utilities::convertToDateTime怎么用?PHP Utilities::convertToDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WindowsAzure\Common\Internal\Utilities的用法示例。


在下文中一共展示了Utilities::convertToDateTime方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Parses the given array into signed identifiers.
  * 
  * @param string $publicAccess The container public access.
  * @param array  $parsed       The parsed response into array representation.
  * 
  * @return none
  */
 public static function create($publicAccess, $parsed)
 {
     $result = new ContainerAcl();
     $result->_publicAccess = $publicAccess;
     $result->_signedIdentifiers = array();
     if (!empty($parsed) && is_array($parsed['SignedIdentifier'])) {
         $entries = $parsed['SignedIdentifier'];
         $temp = Utilities::getArray($entries);
         foreach ($temp as $value) {
             $startString = urldecode($value['AccessPolicy']['Start']);
             $expiryString = urldecode($value['AccessPolicy']['Expiry']);
             $start = Utilities::convertToDateTime($startString);
             $expiry = Utilities::convertToDateTime($expiryString);
             $permission = $value['AccessPolicy']['Permission'];
             $id = $value['Id'];
             $result->addSignedIdentifier($id, $start, $expiry, $permission);
         }
     }
     return $result;
 }
开发者ID:bitmovin,项目名称:azure-sdk-for-php,代码行数:28,代码来源:ContainerACL.php

示例2: testParseEntities

 public function testParseEntities()
 {
     // Setup
     $atomSerializer = new AtomReaderWriter();
     $pk1 = '123';
     $pk2 = '124';
     $pk3 = '125';
     $e1 = TestResources::getTestEntity($pk1, '1');
     $e2 = TestResources::getTestEntity($pk2, '2');
     $e3 = TestResources::getTestEntity($pk3, '3');
     $e1->setETag('W/"datetime\'2012-05-17T00%3A59%3A32.1131734Z\'"');
     $e2->setETag('W/"datetime\'2012-05-17T00%3A59%3A32.4252358Z\'"');
     $e3->setETag('W/"datetime\'2012-05-17T00%3A59%3A32.7533014Z\'"');
     $e1->setTimestamp(Utilities::convertToDateTime('2012-05-17T00:59:32.0000473Z'));
     $e2->setTimestamp(Utilities::convertToDateTime('2012-05-17T00:59:32.0000473Z'));
     $e3->setTimestamp(Utilities::convertToDateTime('2012-05-17T00:59:32.0000473Z'));
     $expected = array($e1, $e2, $e3);
     $entitiesAtom = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
                     <feed xml:base="http://aogail2.table.core.windows.net/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
                     <title type="text">queryentitieswithmultipleentities</title>
                     <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities</id>
                     <updated>2012-05-17T00:59:32Z</updated>
                     <link rel="self" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities" />
                     <entry m:etag="W/&quot;datetime\'2012-05-17T00%3A59%3A32.1131734Z\'&quot;">
                         <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities(PartitionKey=\'123\',RowKey=\'1\')</id>
                         <title type="text"></title>
                         <updated>2012-05-17T00:59:32Z</updated>
                         <author>
                         <name />
                         </author>
                         <link rel="edit" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities(PartitionKey=\'123\',RowKey=\'1\')" />
                         <category term="aogail2.queryentitieswithmultipleentities" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
                         <content type="application/xml">
                         <m:properties>
                             <d:PartitionKey>123</d:PartitionKey>
                             <d:RowKey>1</d:RowKey>
                             <d:Timestamp m:type="Edm.DateTime">2012-05-17T00:59:32.1131734Z</d:Timestamp>
                             <d:CustomerId m:type="Edm.Int32">890</d:CustomerId>
                             <d:CustomerName>John</d:CustomerName>
                             <d:IsNew m:type="Edm.Boolean">true</d:IsNew>
                             <d:JoinDate m:type="Edm.DateTime">2012-01-26T18:26:19Z</d:JoinDate>
                         </m:properties>
                         </content>
                     </entry>
                     <entry m:etag="W/&quot;datetime\'2012-05-17T00%3A59%3A32.4252358Z\'&quot;">
                         <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities(PartitionKey=\'124\',RowKey=\'2\')</id>
                         <title type="text"></title>
                         <updated>2012-05-17T00:59:32Z</updated>
                         <author>
                         <name />
                         </author>
                         <link rel="edit" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities(PartitionKey=\'124\',RowKey=\'2\')" />
                         <category term="aogail2.queryentitieswithmultipleentities" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
                         <content type="application/xml">
                         <m:properties>
                             <d:PartitionKey>124</d:PartitionKey>
                             <d:RowKey>2</d:RowKey>
                             <d:Timestamp m:type="Edm.DateTime">2012-05-17T00:59:32.4252358Z</d:Timestamp>
                             <d:CustomerId m:type="Edm.Int32">890</d:CustomerId>
                             <d:CustomerName>John</d:CustomerName>
                             <d:IsNew m:type="Edm.Boolean">true</d:IsNew>
                             <d:JoinDate m:type="Edm.DateTime">2012-01-26T18:26:19Z</d:JoinDate>
                         </m:properties>
                         </content>
                     </entry>
                     <entry m:etag="W/&quot;datetime\'2012-05-17T00%3A59%3A32.7533014Z\'&quot;">
                         <id>http://aogail2.table.core.windows.net/queryentitieswithmultipleentities(PartitionKey=\'125\',RowKey=\'3\')</id>
                         <title type="text"></title>
                         <updated>2012-05-17T00:59:32Z</updated>
                         <author>
                         <name />
                         </author>
                         <link rel="edit" title="queryentitieswithmultipleentities" href="queryentitieswithmultipleentities(PartitionKey=\'125\',RowKey=\'3\')" />
                         <category term="aogail2.queryentitieswithmultipleentities" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
                         <content type="application/xml">
                         <m:properties>
                             <d:PartitionKey>125</d:PartitionKey>
                             <d:RowKey>3</d:RowKey>
                             <d:Timestamp m:type="Edm.DateTime">2012-05-17T00:59:32.7533014Z</d:Timestamp>
                             <d:CustomerId m:type="Edm.Int32">890</d:CustomerId>
                             <d:CustomerName>John</d:CustomerName>
                             <d:IsNew m:type="Edm.Boolean">true</d:IsNew>
                             <d:JoinDate m:type="Edm.DateTime">2012-01-26T18:26:19Z</d:JoinDate>
                         </m:properties>
                         </content>
                     </entry>
                     </feed>
                     ';
     // Test
     $actual = $atomSerializer->parseEntities($entitiesAtom);
     // Assert
     $this->assertEquals($expected, $actual);
 }
开发者ID:jdruid,项目名称:Microsoft-Azure-PHP-SDK-Storage,代码行数:93,代码来源:AtomReaderWriterTest.php

示例3: unserializeQueryValue

 /**
  * Converts the value into its proper type.
  * 
  * @param string $type  The edm type.
  * @param string $value The edm value.
  * 
  * @return mix
  * 
  * @throws \InvalidArgumentException
  */
 public static function unserializeQueryValue($type, $value)
 {
     // Having null value means that the user wants to remove the property name
     // associated with this value. Leave the value as null so this hold.
     if (is_null($value)) {
         return null;
     } else {
         switch ($type) {
             case self::GUID:
             case self::STRING:
             case self::INT64:
             case null:
                 // NULL also is treated as EdmType::STRING
                 return strval($value);
             case self::BINARY:
                 return base64_decode($value);
             case self::DATETIME:
                 return Utilities::convertToDateTime($value);
             case self::BOOLEAN:
                 return Utilities::toBoolean($value);
             case self::DOUBLE:
                 return doubleval($value);
             case self::INT32:
                 return intval($value);
             default:
                 throw new \InvalidArgumentException();
         }
     }
 }
开发者ID:pankajadhyapak,项目名称:um_new,代码行数:39,代码来源:EdmType.php

示例4: getTestEntity

 public static function getTestEntity($partitionKey, $rowKey)
 {
     $entity = new Entity();
     $entity->setPartitionKey($partitionKey);
     $entity->setRowKey($rowKey);
     $entity->addProperty('CustomerId', EdmType::INT32, 890);
     $entity->addProperty('CustomerName', null, 'John');
     $entity->addProperty('IsNew', EdmType::BOOLEAN, true);
     $entity->addProperty('JoinDate', EdmType::DATETIME, Utilities::convertToDateTime('2012-01-26T18:26:19.0000473Z'));
     return $entity;
 }
开发者ID:rdohms,项目名称:azure-sdk-for-php,代码行数:11,代码来源:TestResources.php

示例5: testConvertToDateTimeWithDate

 /**
  * @covers WindowsAzure\Common\Internal\Utilities::convertToDateTime
  */
 public function testConvertToDateTimeWithDate()
 {
     // Setup
     $date = new \DateTime();
     // Test
     $actual = Utilities::convertToDateTime($date);
     // Assert
     $this->assertEquals($date, $actual);
 }
开发者ID:southworkscom,项目名称:azure-sdk-for-php,代码行数:12,代码来源:UtilitiesTest.php

示例6: getContainerAcl

 /**
  * Gets the access control list (ACL) and any container-level access policies 
  * for the container.
  * 
  * @param string                    $container The container name.
  * @param Models\BlobServiceOptions $options   The optional parameters.
  * 
  * @return Models\GetContainerAclResult
  * 
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/dd179469.aspx
  */
 public function getContainerAcl($container, $options = null)
 {
     Validate::isString($container, 'container');
     $method = Resources::HTTP_GET;
     $headers = array();
     $postParams = array();
     $queryParams = array();
     $path = $container;
     $statusCode = Resources::STATUS_OK;
     if (is_null($options)) {
         $options = new BlobServiceOptions();
     }
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
     $this->addOptionalQueryParam($queryParams, Resources::QP_REST_TYPE, 'container');
     $this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'acl');
     $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode);
     $access = $response->getHeader(Resources::X_MS_BLOB_PUBLIC_ACCESS);
     $etag = $response->getHeader(Resources::ETAG);
     $modified = $response->getHeader(Resources::LAST_MODIFIED);
     $modifiedDate = Utilities::convertToDateTime($modified);
     $parsed = $this->dataSerializer->unserialize($response->getBody());
     return GetContainerAclResult::create($access, $etag, $modifiedDate, $parsed);
 }
开发者ID:yszar,项目名称:linuxwp,代码行数:34,代码来源:BlobRestProxy.php

示例7: mutateEntity

 static function mutateEntity($ent, $pivot)
 {
     if ($pivot == MutatePivot::CHANGE_VALUES) {
         self::mutateEntityChangeValues($ent);
     } else {
         if ($pivot == MutatePivot::ADD_PROPERTY) {
             $ent->addProperty('BOOLEAN' . TableServiceFunctionalTestData::getNewKey(), EdmType::BOOLEAN, true);
             $ent->addProperty('DATETIME' . TableServiceFunctionalTestData::getNewKey(), EdmType::DATETIME, Utilities::convertToDateTime('2012-01-26T18:26:19.0000473Z'));
             $ent->addProperty('DOUBLE' . TableServiceFunctionalTestData::getNewKey(), EdmType::DOUBLE, 12345678901);
             $ent->addProperty('GUID' . TableServiceFunctionalTestData::getNewKey(), EdmType::GUID, '90ab64d6-d3f8-49ec-b837-b8b5b6367b74');
             $ent->addProperty('INT32' . TableServiceFunctionalTestData::getNewKey(), EdmType::INT32, 23);
             $ent->addProperty('INT64' . TableServiceFunctionalTestData::getNewKey(), EdmType::INT64, '-1');
             $ent->addProperty('STRING' . TableServiceFunctionalTestData::getNewKey(), EdmType::STRING, 'this is a test!');
         } else {
             if ($pivot == MutatePivot::REMOVE_PROPERTY) {
                 $propToRemove = null;
                 foreach ($ent->getProperties() as $propName => $propValue) {
                     // Don't mess with the keys.
                     if ($propName == 'PartitionKey' || $propName == 'RowKey' || $propName == 'Timestamp') {
                         continue;
                     }
                     $propToRemove = $propName;
                     break;
                 }
                 $props = $ent->getProperties();
                 unset($props[$propToRemove]);
             } else {
                 if ($pivot == MutatePivot::NULL_PROPERTY) {
                     foreach ($ent->getProperties() as $propName => $propValue) {
                         // Don't mess with the keys.
                         if ($propName == 'PartitionKey' || $propName == 'RowKey' || $propName == 'Timestamp') {
                             continue;
                         }
                         $propValue->setValue(null);
                     }
                 }
             }
         }
     }
 }
开发者ID:bitmovin,项目名称:azure-sdk-for-php,代码行数:40,代码来源:TableServiceFunctionalTestUtils.php

示例8: getInterestingEntities

 static function getInterestingEntities()
 {
     $ret = array();
     array_push($ret, self::getSimpleEntity());
     $e = new Entity();
     $e->addProperty('RowKey', EdmType::STRING, self::getNewKey());
     $e->addProperty('PartitionKey', null, self::getNewKey());
     array_push($ret, $e);
     $e = new Entity();
     $e->setPartitionKey(self::getNewKey());
     $e->setRowKey(self::getNewKey());
     $e->addProperty('BINARY', EdmType::BINARY, chr(0) . chr(1) . chr(2) . chr(3) . chr(4));
     $e->addProperty('BOOLEAN', EdmType::BOOLEAN, true);
     $e->addProperty('DATETIME', EdmType::DATETIME, Utilities::convertToDateTime('2012-01-26T18:26:19.0000473Z'));
     $e->addProperty('DOUBLE', EdmType::DOUBLE, 12345678901);
     $e->addProperty('GUID', EdmType::GUID, '90ab64d6-d3f8-49ec-b837-b8b5b6367b74');
     $e->addProperty('INT32', EdmType::INT32, 23);
     $e->addProperty('INT64', EdmType::INT64, '-1');
     $now = new \DateTime();
     $e->addProperty('STRING', EdmType::STRING, $now->format(\DateTime::COOKIE));
     array_push($ret, $e);
     $e = new Entity();
     $e->setPartitionKey(self::getNewKey());
     $e->setRowKey(self::getNewKey());
     $e->addProperty('test', EdmType::BOOLEAN, true);
     $e->addProperty('test2', EdmType::STRING, 'value');
     $e->addProperty('test3', EdmType::INT32, 3);
     $e->addProperty('test4', EdmType::INT64, '12345678901');
     $e->addProperty('test5', EdmType::DATETIME, new \DateTime());
     array_push($ret, $e);
     $e = new Entity();
     $e->setPartitionKey(self::getNewKey());
     +$e->setRowKey(self::getNewKey());
     $e->addProperty('BINARY', EdmType::BINARY, null);
     $e->addProperty('BOOLEAN', EdmType::BOOLEAN, null);
     $e->addProperty('DATETIME', EdmType::DATETIME, null);
     $e->addProperty('DOUBLE', EdmType::DOUBLE, null);
     $e->addProperty('GUID', EdmType::GUID, null);
     $e->addProperty('INT32', EdmType::INT32, null);
     $e->addProperty('INT64', EdmType::INT64, null);
     $e->addProperty('STRING', EdmType::STRING, null);
     array_push($ret, $e);
     return $ret;
 }
开发者ID:rdohms,项目名称:azure-sdk-for-php,代码行数:44,代码来源:TableServiceFunctionalTestData.php

示例9: testSetTimestamp

 /**
  * @covers WindowsAzure\Table\Models\Entity::setTimestamp
  * @covers WindowsAzure\Table\Models\Entity::getTimestamp
  */
 public function testSetTimestamp()
 {
     // Setup
     $entity = new Entity();
     $expected = Utilities::convertToDateTime(Utilities::isoDate());
     // Test
     $entity->setTimestamp($expected);
     // Assert
     $this->assertEquals($expected, $entity->getTimestamp());
 }
开发者ID:jdruid,项目名称:Microsoft-Azure-PHP-SDK-Storage,代码行数:14,代码来源:EntityTest.php

示例10: testSetContainerACLWorks

 /**
  * @covers WindowsAzure\Blob\BlobRestProxy::createContainer
  * @covers WindowsAzure\Blob\BlobRestProxy::deleteContainer
  * @covers WindowsAzure\Blob\BlobRestProxy::getContainerACL
  * @covers WindowsAzure\Blob\BlobRestProxy::setContainerACL
  */
 public function testSetContainerACLWorks()
 {
     // Arrange
     $container = self::$_creatable_container_4;
     $expiryStartDate = new \DateTime();
     $expiryStartDate->setDate(2010, 1, 1);
     $expiryEndDate = new \DateTime();
     $expiryEndDate->setDate(2020, 1, 1);
     // Act
     $this->restProxy->createContainer($container);
     $acl = new ContainerACL();
     $acl->setPublicAccess(PublicAccessType::BLOBS_ONLY);
     $acl->addSignedIdentifier('test', $expiryStartDate, $expiryEndDate, 'rwd');
     $this->restProxy->setContainerACL($container, $acl);
     $res = $this->restProxy->getContainerACL($container);
     $acl2 = $res->getContainerACL();
     $this->restProxy->deleteContainer($container);
     // Assert
     $this->assertNotNull($acl2, '$acl2');
     $this->assertNotNull($res->getETag(), '$res->getETag()');
     $this->assertNotNull($res->getLastModified(), '$res->getLastModified()');
     $this->assertNotNull($acl2->getPublicAccess(), '$acl2->getPublicAccess()');
     $this->assertEquals(PublicAccessType::BLOBS_ONLY, $acl2->getPublicAccess(), '$acl2->getPublicAccess()');
     $this->assertEquals(1, count($acl2->getSignedIdentifiers()), 'count($acl2->getSignedIdentifiers())');
     $signedids = $acl2->getSignedIdentifiers();
     $this->assertEquals('test', $signedids[0]->getId(), '$signedids[0]->getId()');
     $expiryStartDate = $expiryStartDate->setTimezone(new \DateTimeZone('UTC'));
     $expiryEndDate = $expiryEndDate->setTimezone(new \DateTimeZone('UTC'));
     $this->assertEquals(Utilities::convertToDateTime($expiryStartDate), Utilities::convertToDateTime($signedids[0]->getAccessPolicy()->getStart()), '$signedids[0]->getAccessPolicy()->getStart()');
     $this->assertEquals(Utilities::convertToDateTime($expiryEndDate), Utilities::convertToDateTime($signedids[0]->getAccessPolicy()->getExpiry()), '$signedids[0]->getAccessPolicy()->getExpiry()');
     $this->assertEquals('rwd', $signedids[0]->getAccessPolicy()->getPermission(), '$signedids[0]->getAccessPolicy()->getPermission()');
 }
开发者ID:bitmovin,项目名称:azure-sdk-for-php,代码行数:38,代码来源:BlobServiceIntegrationTest.php


注:本文中的WindowsAzure\Common\Internal\Utilities::convertToDateTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。