Support

Account

Home Forums General Issues 1970 date problem php version :5.3.29

Solving

1970 date problem php version :5.3.29

  • Hi.

    My site is located in a hosting which php version is 5.3.29 and apparently I should use the code below , but it shows 1970 1 january , I would be thankful to help me if I should use another code…

    <?php

    $date = get_field(‘exhibitionstartdate’);

    $y = substr($date, 0, 4);
    $m = substr($date, 4, 2);
    $d = substr($date, 6, 2);

    $time = strtotime(“{$d}-{$m}-{$y}”);

    echo date(‘F n Y’, $time);

    ?>

  • That code is assuming your get_field('exhibitionstartdate') is in the format yyyymmdd. If you do:

    
    echo get_field('exhibitionstartdate');
    

    What is the output?

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘1970 date problem php version :5.3.29’ is closed to new replies.