date_sub

(PHP 5 >= 5.3.0)

date_subPseudonim pentru DateTime::sub()

Descrierea

Această funcție este pseudonim pentru: DateTime::sub()

add a note add a note

User Contributed Notes 1 note

up
1
Jonathan Poissant
3 years ago
You cannot replace date_sub('2000-01-20') by DateTime::sub('2000-01-20') because DateTime::sub is not static. You have to create the DateTime object first.

Example:

<?php $dateA = date_sub('2000-01-20', date_interval_create_from_date_string('10 days')); ?>

will be replace by
<?php
$dateB
= new DateTime('2000-01-20');
$dateA = $dateB->sub(date_interval_create_from_date_string('10 days'));
?>
To Top