Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • None
  • PHP

Classes

  • ArrayHash
  • ArrayList
  • Callback
  • DateTime
  • Framework
  • FreezableObject
  • Image
  • Object
  • ObjectMixin

Interfaces

  • IFreezable

Exceptions

  • ArgumentOutOfRangeException
  • DeprecatedException
  • DirectoryNotFoundException
  • FatalErrorException
  • FileNotFoundException
  • InvalidArgumentException
  • InvalidStateException
  • IOException
  • MemberAccessException
  • NotImplementedException
  • NotSupportedException
  • OutOfRangeException
  • StaticClassException
  • UnexpectedValueException
  • UnknownImageFileException
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (http://nette.org)
 5:  *
 6:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
 7:  *
 8:  * For the full copyright and license information, please view
 9:  * the file license.txt that was distributed with this source code.
10:  */
11: 
12: namespace Nette;
13: 
14: use Nette;
15: 
16: 
17: 
18: /**
19:  * DateTime with serialization and timestamp support for PHP 5.2.
20:  *
21:  * @author     David Grudl
22:  */
23: class DateTime extends \DateTime
24: {
25:     /** minute in seconds */
26:     const MINUTE = 60;
27: 
28:     /** hour in seconds */
29:     const HOUR = 3600;
30: 
31:     /** day in seconds */
32:     const DAY = 86400;
33: 
34:     /** week in seconds */
35:     const WEEK = 604800;
36: 
37:     /** average month in seconds */
38:     const MONTH = 2629800;
39: 
40:     /** average year in seconds */
41:     const YEAR = 31557600;
42: 
43: 
44: 
45:     /**
46:      * DateTime object factory.
47:      * @param  string|int|\DateTime
48:      * @return DateTime
49:      */
50:     public static function from($time)
51:     {
52:         if ($time instanceof \DateTime) {
53:             return clone $time;
54: 
55:         } elseif (is_numeric($time)) {
56:             if ($time <= self::YEAR) {
57:                 $time += time();
58:             }
59:             return new static(date('Y-m-d H:i:s', $time));
60: 
61:         } else { // textual or NULL
62:             return new static($time);
63:         }
64:     }
65: 
66: 
67: 
68:     public function __toString()
69:     {
70:         return $this->format('Y-m-d H:i:s');
71:     }
72: 
73: 
74: 
75:     public function modifyClone($modify = '')
76:     {
77:         $dolly = clone $this;
78:         return $modify ? $dolly->modify($modify) : $dolly;
79:     }
80: 
81: 
82: 
83:     }
84: 
Nette Framework 2.0.0 API API documentation generated by ApiGen 2.7.0