PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE A ( DATA VARCHAR(10) NOT NULL ); INSERT INTO A ( DATA ) VALUES ('a'); INSERT INTO A ( DATA ) VALUES ('b'); SELECT * FROM A;
Copy Clear
Copy Format Clear
<?php use Carbon\Carbon; $str = "2024-10-11 09:00:00.000"; $c = preg_replace('/\.000/', "", $str); $a = DateTime::createFromFormat(format: "Y-m-d H:i:s.u", datetime: $str); // get DB version using PDO $b = $a->format("Y-m-d H:i:s.u"); var_dump($b); $d = date("Y-m-d H:i:s.000", strtotime($str)); var_dump($d);
Show:  
Copy Clear