Support » Plugin: Date and Time Picker Field » unable to set datetime value

  • neha

    (@glassfairy)


    setting the datetimepicker value via functions.php and then trying to check with currentdate but the condition always fails.

    functions.php

    $randnos=rand(0,30);
    $randhrs=rand(00,24);
    $randmin=rand(00,60);
    $randsec=rand(00,60);
    
    $ttxt='+'.$randnos.' days +'.$randhrs.' Hours +'.$randmin.' minutes +'.$randsec.' seconds';
    $newTime = date("d/m/Y H:m:s",strtotime($ttxt));
    update_post_meta($post_id,'mydate',$newTime);

    template

    $tdate=new DateTime();
    $mystring=get_field('mydate');
    $mystring=date("d/m/Y H:m:s",strtotime($mystring));
    echo $mystring;
    if ($mystring>=$tdate){
    echo "yahoo";
    }

    and it never passes the if condition

    https://wordpress.org/plugins/acf-field-date-time-picker/

  • The topic ‘unable to set datetime value’ is closed to new replies.