I currently have a date in this format
2010-03-03 10:39:18
which is a TIMESTAMP
field in MySQL. I need to have the date in this format for a search engine called Solr:
1995-12-31T23:59:59Z
Here is some text from their website about dates:
Solr expects dates to be in UTC when indexing. The format for this date field is of the form 1995-12-31T23:59:59Z, and is a more restricted form of the canonical representation of dateTime http://www.w3.org/TR/xmlschema-2/#dateTime. The trailing "Z" designates UTC time and is mandatory. Optional fractional seconds are allowed: 1995-12-31T23:59:59.999Z All other components are mandatory.
I was given this code from another Q here on SO, but it doesn't work. Solr complains about an "invalid time string":
$solr_date = date('c', (strtotime($date_from_mysql)); // doesn't work
When echoing $solr_date,
the trailing Z
mentioned above isn't there. Thanks.