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


PHP Date::toValue方法代码示例

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


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

示例1: testToValue

 /**
  * Test for toValue
  */
 public function testToValue()
 {
     $locale = new Locale('de_AT');
     $date = new Date(1234567890, null, $locale);
     $date->setTimezone(date_default_timezone_get());
     $this->assertSame(1234567890, $date->toValue());
     $this->assertSame(14, $date->toValue(Date::DAY));
     $date->setTimezone('UTC');
     $this->assertSame(13, $date->toValue(Date::DAY));
     $this->assertFalse($date->toValue(Date::WEEKDAY_SHORT));
     $this->assertSame(13, $date->toValue(Date::DAY_SHORT));
     $this->assertFalse($date->toValue(Date::WEEKDAY));
     $this->assertSame(5, $date->toValue(Date::WEEKDAY_8601));
     $this->assertFalse($date->toValue(Date::DAY_SUFFIX));
     $this->assertSame(5, $date->toValue(Date::WEEKDAY_DIGIT));
     $this->assertSame(43, $date->toValue(Date::DAY_OF_YEAR));
     $this->assertFalse($date->toValue(Date::WEEKDAY_NARROW));
     $this->assertFalse($date->toValue(Date::WEEKDAY_NAME));
     $this->assertSame(7, $date->toValue(Date::WEEK));
     $this->assertFalse($date->toValue(Date::MONTH_NAME));
     $this->assertSame(2, $date->toValue(Date::MONTH));
     $this->assertFalse($date->toValue(Date::MONTH_NAME_SHORT));
     $this->assertSame(2, $date->toValue(Date::MONTH_SHORT));
     $this->assertSame(28, $date->toValue(Date::MONTH_DAYS));
     $this->assertFalse($date->toValue(Date::MONTH_NAME_NARROW));
     $this->assertSame(0, $date->toValue(Date::LEAPYEAR));
     $this->assertSame(2009, $date->toValue(Date::YEAR_8601));
     $this->assertSame(2009, $date->toValue(Date::YEAR));
     $this->assertSame(9, $date->toValue(Date::YEAR_SHORT));
     $this->assertSame(9, $date->toValue(Date::YEAR_SHORT_8601));
     $this->assertFalse($date->toValue(Date::MERIDIEM));
     $this->assertSame(21, $date->toValue(Date::SWATCH));
     $this->assertSame(11, $date->toValue(Date::HOUR_SHORT_AM));
     $this->assertSame(23, $date->toValue(Date::HOUR_SHORT));
     $this->assertSame(11, $date->toValue(Date::HOUR_AM));
     $this->assertSame(23, $date->toValue(Date::HOUR));
     $this->assertSame(31, $date->toValue(Date::MINUTE));
     $this->assertSame(30, $date->toValue(Date::SECOND));
     $this->assertSame(0, $date->toValue(Date::MILLISECOND));
     $this->assertSame(31, $date->toValue(Date::MINUTE_SHORT));
     $this->assertSame(30, $date->toValue(Date::SECOND_SHORT));
     $this->assertFalse($date->toValue(Date::TIMEZONE_NAME));
     $this->assertSame(0, $date->toValue(Date::DAYLIGHT));
     $this->assertSame(0, $date->toValue(Date::GMT_DIFF));
     $this->assertFalse($date->toValue(Date::GMT_DIFF_SEP));
     $this->assertFalse($date->toValue(Date::TIMEZONE));
     $this->assertSame(0, $date->toValue(Date::TIMEZONE_SECS));
     $this->assertFalse($date->toValue(Date::ISO_8601));
     $this->assertFalse($date->toValue(Date::RFC_2822));
     $this->assertSame(1234567890, $date->toValue(Date::TIMESTAMP));
     $this->assertFalse($date->toValue(Date::ERA));
     $this->assertFalse($date->toValue(Date::ERA_NAME));
     $this->assertFalse($date->toValue(Date::DATES));
     $this->assertFalse($date->toValue(Date::DATE_FULL));
     $this->assertFalse($date->toValue(Date::DATE_LONG));
     $this->assertFalse($date->toValue(Date::DATE_MEDIUM));
     $this->assertFalse($date->toValue(Date::DATE_SHORT));
     $this->assertFalse($date->toValue(Date::TIMES));
     $this->assertFalse($date->toValue(Date::TIME_FULL));
     $this->assertFalse($date->toValue(Date::TIME_LONG));
     $this->assertFalse($date->toValue(Date::TIME_MEDIUM));
     $this->assertFalse($date->toValue(Date::TIME_SHORT));
     $this->assertFalse($date->toValue(Date::DATETIME));
     $this->assertFalse($date->toValue(Date::DATETIME_FULL));
     $this->assertFalse($date->toValue(Date::DATETIME_LONG));
     $this->assertFalse($date->toValue(Date::DATETIME_MEDIUM));
     $this->assertFalse($date->toValue(Date::DATETIME_SHORT));
     $this->assertFalse($date->toValue(Date::ATOM));
     $this->assertFalse($date->toValue(Date::COOKIE));
     $this->assertFalse($date->toValue(Date::RFC_822));
     $this->assertFalse($date->toValue(Date::RFC_850));
     $this->assertFalse($date->toValue(Date::RFC_1036));
     $this->assertFalse($date->toValue(Date::RFC_1123));
     $this->assertFalse($date->toValue(Date::RFC_3339));
     $this->assertFalse($date->toValue(Date::RSS));
     $this->assertFalse($date->toValue(Date::W3C));
     $date->setTimezone('Indian/Maldives');
     $this->assertFalse($date->toValue(Date::WEEKDAY_SHORT));
     $this->assertSame(14, $date->toValue(Date::DAY_SHORT));
     $this->assertFalse($date->toValue(Date::WEEKDAY));
     $this->assertSame(6, $date->toValue(Date::WEEKDAY_8601));
     $this->assertFalse($date->toValue(Date::DAY_SUFFIX));
     $this->assertSame(6, $date->toValue(Date::WEEKDAY_DIGIT));
     $this->assertSame(44, $date->toValue(Date::DAY_OF_YEAR));
     $this->assertFalse($date->toValue(Date::WEEKDAY_NARROW));
     $this->assertFalse($date->toValue(Date::WEEKDAY_NAME));
     $this->assertSame(7, $date->toValue(Date::WEEK));
     $this->assertFalse($date->toValue(Date::MONTH_NAME));
     $this->assertSame(2, $date->toValue(Date::MONTH));
     $this->assertFalse($date->toValue(Date::MONTH_NAME_SHORT));
     $this->assertSame(2, $date->toValue(Date::MONTH_SHORT));
     $this->assertSame(28, $date->toValue(Date::MONTH_DAYS));
     $this->assertFalse($date->toValue(Date::MONTH_NAME_NARROW));
     $this->assertSame(0, $date->toValue(Date::LEAPYEAR));
     $this->assertSame(2009, $date->toValue(Date::YEAR_8601));
     $this->assertSame(2009, $date->toValue(Date::YEAR));
     $this->assertSame(9, $date->toValue(Date::YEAR_SHORT));
//.........这里部分代码省略.........
开发者ID:rikaix,项目名称:zf2,代码行数:101,代码来源:DateTest.php


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