Hi all, i'm new learner for cake.php
-- i'm trying to import my excel-CSV data to ms sql database thro the controller.php
but one of my data in excel-CSV which is DATE display in this format (Mon, 21 May 2014)
how to convert this format (Mon, 21 May 2014) to 21-05-2014 by ignore the mon?
thank you and appreciate for your comment.
while(! feof($file))
{
$curDataRow = fgetcsv($file);
$i = 0;
foreach($fields as $key => $field_name)
{
if(strtolower($field_name) == 'date')
{
$date = $curDataRow[$i];
$date ['Upload'][$field_name] =('\m\o\n,', 'd-m-Y', $date);
$this->request->data['Upload'][$field_name] = date('Y-m-d', strtotime($date));
}
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment