How to convert this date format?
Sophie
Sophie 2018-02-10 18:32:15
0
4
1049

Can anyone help me to see how to convert the time format 20182800255 into 2018-02-08 00:02:55?

If the month, day and hour are 1 digit

when 0 is not added
Sophie
Sophie

reply all (1)
董先生

First take out the time and then process it, example:


## $a=date("m");

If ($ A/10 & LT; 1) {// Determine whether the month is zero

$ b = $ a/10*10;

Echo " Today is " . $b . "
";

}

?>


  • reply Do not need if if IF will directly remove the monthly format by 10,
    董先生 author 2018-02-11 16:35:39
  • reply Then, take out a specific position to judge the value, and output it after processing.
    董先生 author 2018-02-11 16:47:21
  • reply <?php //Please enter your php code $y=date("Y"); $m=date("m")/10*10; $d=date("d"); $t=date("H:i:s"); echo $y."-".$m."-".$d." ".$t."<br>"; ?>
    董先生 author 2018-02-12 09:55:58
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!