1.2.365. Don’t Add Seconds

Avoid adding seconds to a date, and use DateTime\:\:modify to add an interval.

This method will handle situations like daylight savings, leap seconds and even leap days.

<?php

// Tomorrow, same time
$tomorrow = new DateTime('now')->modify('+1 day');

// Tomorrow, but may be not at the same hour
$tomorrow = date('now') + 86400;

?>

See also DateTime::modify and datetime.

1.2.365.1. Connex PHP features

1.2.365.1.1. Specs

Short name

Structures/DontAddSeconds

Rulesets

All, Analyze, Changed Behavior

Exakat since

2.3.9

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Available in

Entreprise Edition, Exakat Cloud