**The Question:**

I have files with time stamp added to their names, like this :

> 
> "presentation final project\_20141207182834657.pptx"
> 
> 
> 

And

> 
> "presentation final project\_201412071864035.pptx"
> 
> 
> 

How can I remove the "\_date" part from it ? 

Notice that i cant count char because sometimes the date is 15 char' and sometimes more, I need somehow to remove a part of the string that start with "\_20" until it reach the "." (dot) or maybe someone got a better idea.

**Background:**

I have a storage of files, before I upload a file I give it a time stamp like this :

(JavaScript)

```
function getDate() {
var today = new Date();
var year = today.getFullYear().toString();
var month = (today.getMonth()+1).toString();
var day = today.getDate();

if (day < 10)
    day = "0" + day.toString();
else
    day = day.toString();

var hours = today.getHours().toString();
var minutes = today.getMinutes().toString();
var seconds = today.getSeconds().toString();
var miliSecond = today.getMilliseconds().toString();

return year+month+day+hours+minutes+seconds+miliSecond;
}

```

And what is return from this function I added to the file name.

Now I want to return the file to the user but without the date stamp i added to the file..

Thank you.

**Update**

Let me give a wild scenario, there is underscore "\_" not only before the date like this :

> 
> "presentation\_final\_project\_201412071864035.pptx"
> 
> 
> 

I cant trust the index of "\_" because its can be everywhere.