i am trying to convert a variable having date time as string to time stamp
with the code below it always gives the output as 01/01/1970 00:01:00
no matter what date time is present in the string
mydate is a datetimepicker
in mydate the date is set via
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');
$timestamp = DateTime::createFromFormat('d/m/Y H:m:s', $mystring)->getTimestamp();
$mystring= date("d/m/Y H:m:s", $timestamp );
if ($mystring>=$tdate){
echo "yahoo";
}
and it never passes the if condition plus it gives me the Call to a member function getTimestamp() on a non-object