Hi,
Does anyone has fast way to convert the rrs-date format to MySQL date format?
Thanks,
Solved Converting rrs-date format to MySQL date format
Re: Converting rrs-date format to MySQL date format
strtotime is great function in php
this should do the trick.
Code: Select all
$mysql_date=date(Y-m-d', strtotime($rss_date));
Re: Converting rrs-date format to MySQL date format
Hi,
strtotime() doesn't do it for me.
I have the following code:
Wich results in:
Fri, 5 Mar 2010 08:00:00 System/Localtime
1970-01-01
My php version:
PHP 5.2.6
strtotime() doesn't do it for me.
I have the following code:
Code: Select all
$pubdate=date('Y-m-d',strtotime($rssdate));
print $rssdate."\n";
print $pubdate."\n";
Fri, 5 Mar 2010 08:00:00 System/Localtime
1970-01-01
My php version:
PHP 5.2.6
Re: Converting rrs-date format to MySQL date format
Hi,
I tested it with php version 5.2.10-2,
and it works OK.
result:
Fri, 5 Mar 2010 08:00:00 System/Localtime
2010-03-05
Try upgrading to the latest version.
I tested it with php version 5.2.10-2,
and it works OK.
result:
Fri, 5 Mar 2010 08:00:00 System/Localtime
2010-03-05
Try upgrading to the latest version.
Re: Converting rrs-date format to MySQL date format
As you only need the date.
Try it with only the first part:
It should give a correct result:
Fri,5Mar2010
2010-03-05
Try it with only the first part:
Code: Select all
$date_array=explode(' ',$rssdate);
$newdate=$date_array[0].$date_array[1].$date_array[2].$date_array[3];
$pubdate=date('Y-m-d',strtotime($newdate));
print $newdate."\n";
print $pubdate."\n";
Fri,5Mar2010
2010-03-05
Re: Converting rrs-date format to MySQL date format
Thanks,
This works.
It gets the correct date.
This works.
It gets the correct date.