how to re-format datetime string in php?

后端 未结 8 925
栀梦
栀梦 2020-11-29 07:00

I receive a datetime from a plugin. I put it into a variable:

$datetime = \"20130409163705\"; 

That actually translates to yyyymm

相关标签:
8条回答
  • 2020-11-29 07:53

    You could do it like this:

    <?php
    $datetime = "20130409163705"; 
    $format = "YmdHis";
    
    $date = date_parse_from_format ($format, $datetime);
    print_r ($date);
    ?>
    

    You can look at date_parse_from_format() and the accepted format values.

    0 讨论(0)
  • 2020-11-29 07:54
    https://en.functions-online.com/date.html?command={"format":"l jS \\of F Y h:i:s A"}
    
    0 讨论(0)
提交回复
热议问题