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.

Link to comment
Share on other sites

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;
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.