Create new DateTime object with Non-existent values and roll over in PHP

Description

The following code shows how to create new DateTime object with Non-existent values and roll over.

Example


// w w  w  . j a va2s  .  c o  m
<?php
// Non-existent values roll over.
$date = new DateTime('2000-02-30');
echo $date->format('Y-m-d H:i:sP') . "\n";
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone