neo777ph Posted August 31, 2007 Share Posted August 31, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/67406-xml-spreadsheet-question-about-date-format/ Share on other sites More sharing options...
GingerRobot Posted August 31, 2007 Share Posted August 31, 2007 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; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67406-xml-spreadsheet-question-about-date-format/#findComment-338413 Share on other sites More sharing options...
Barand Posted August 31, 2007 Share Posted August 31, 2007 or <?php list($y,$m,$d,$h,$i,$s) = split('[-T:.]', trim($str,'/')); Quote Link to comment https://forums.phpfreaks.com/topic/67406-xml-spreadsheet-question-about-date-format/#findComment-338437 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.