i worked on the code to get subscription start date & end date from the infusionsoft and it return in this format
Start date=20151217T00:00:00
EndDate=20161217T00:00:00
how i can format to YYYY/MM/DD H:M:S ?
and what the 'T' stands for
i worked on the code to get subscription start date & end date from the infusionsoft and it return in this format
Start date=20151217T00:00:00
EndDate=20161217T00:00:00
how i can format to YYYY/MM/DD H:M:S ?
and what the 'T' stands for
The T, according to the the ISO 8601 standard, is the delimiter between the date and time parts.
See: ISO 8601 standard, Wikipedia
There are two functions you could use:
strtotime(date_time_string)
Converts a date/time string into a timestamp.
date(format, timestamp)
Formats a timestamp into a string according to "format".
The example code…
$so_string = '20151217T00:00:00';
$eo_string = '20161217T00:00:00';
$sd_stamp = strtotime($so_string);
$ed_stamp = strtotime($eo_string);
$f_datetime ='Y/m/d H:i:s';
echo 'Start date<br />';
echo ' original: ' . $so_string . '<br />';
echo ' timestamp: ' . $sd_stamp . '<br />';
echo ' formatted: ' . date($f_datetime,$sd_stamp) . '<br /><br />';
echo 'End date<br />';
echo ' original: ' . $eo_string . '<br />';
echo ' timestamp: ' . $ed_stamp. '<br />';
echo ' formatted: ' . date($f_datetime,$ed_stamp) . '<br />';
…will produce this output:
Start date
original: 20151217T00:00:00
timestamp: 1450306800
formatted: 2015/12/17 00:00:00
End date
original: 20161217T00:00:00
timestamp: 1481929200
formatted: 2016/12/17 00:00:00