format('m/d/Y,H:i:s'));//Thisisa"> PHP method to get local time-PHP Chinese Network Q&A
PHP method to get local time
P粉396248578
P粉396248578 2023-09-15 11:40:31
0
1
431

Why can't procedural code get the same results as object-oriented code? I have legacy code that requires program results. Please note that I have a workaround but I would like to understand why the program code is not getting the local time.

`$dt = new DateTime("now", new DateTimeZone('America/Los_Angeles')); $now = strtotime($dt->format('m/d/Y, H:i:s')); //This is a work-around which works $oo = date('Y-m-d H:i:s',$now); //Procedural Code $now = date_timestamp_get($dt); $pc = date('Y.m.d H:i:s',$now); `

P粉396248578
P粉396248578

reply all (1)
P粉384366923

Answer in comments, courtesyAdyson

    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!