note 129221 added to function.microtime

From: Date: Sun, 04 Feb 2024 09:04:49 +0000
Subject: note 129221 added to function.microtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-221175@lists.php.net to get a copy of this message
PHP 7.4.33 (cli) (built: Aug 14 2023 06:42:07) ( NTS ) If microtime(true) on, example 1642510930.000, it return string "1642510930" Problem occurring, when convert to DateTime. Solution: $microTime = microtime(true); if (strlen($microTime) === 10) { $microTime .= '.000000'; } $now = DateTime::createFromFormat('U.u', $microTime); ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 159.148.31.174) ---- Manual Page -- https://php.net/manual/en/function.microtime.php Edit -- https://main.php.net/note/edit/129221 Del: integrated -- https://main.php.net/note/delete/129221/integrated Del: useless -- https://main.php.net/note/delete/129221/useless Del: bad code -- https://main.php.net/note/delete/129221/bad+code Del: spam -- https://main.php.net/note/delete/129221/spam Del: non-english -- https://main.php.net/note/delete/129221/non-english Del: in docs -- https://main.php.net/note/delete/129221/in+docs Del: other reasons-- https://main.php.net/note/delete/129221 Reject -- https://main.php.net/note/reject/129221 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221175) next »