Jump to content

XML Spreadsheet question.. About Date Format


neo777ph

Recommended Posts

when i view my XML spreadsheet file on EXCEL the format of my date is MM-DD-YYYY but when i view it on Notepad++ the format is

/YYYY-MM-DDT00:00:00.000/, I believe this is the default for XML Spreadsheet.

However, what I needed is the format  MM-DD-YYYY.

I tried to use Trim,substr,and explode to clean the data..however the "/" on both end are always retained. I need to remove it "/" before i could insert the date on my DB.hope you could help me.

 

thank you.

Well, im not too sure about the differences in the formatting, however, to get the pieces of the string you need, you could do:

 

<?php
$str = '/YYYY-MM-DDT00:00:00.000/';
list($date,$time) = explode('T',$str);
$date = substr($date,1);
$time = substr($time,0,strlen($time)-1);
echo $date.'<br />';
echo $time;
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.