KapteinMarshall
KapteinMarshall

Reputation: 490

Change format of html input element of type datetime

I am currently developing a mobile web app and I have run into something that bugs me a bit.

I have an Input element of type datetime...

<div class="pinkLabel">Date & Time:</div>
            <div class="ui-block-b"><input data-mini="true" type="datetime" id="OtherClaimDate" /></div>

My problem is this. This input seems to have a default format that looks like this...

2014-01-28T11:55Z

This format looks a bit bad on the app and I would rather it look someting more like this...

**2014-01-28T11:55**

or

**2014-01-28 11:55**

From what I understand reading some other posts the way to go is to use a JQuery plugin and create a mask. Is there another way to accomplish this using javascript possibly ? If not, a short how to on doing this using a JQuery plugin will be much appreciated. But if possible I would prefer a javascript solution.

Thanks in advance guys.

Upvotes: 2

Views: 772

Answers (1)

Govind Singh
Govind Singh

Reputation: 15490

var dt=2014-01-28T11:55;
var ar=dt.split("T");
dt=ar[0]+" "+ar[1];

OR

var a=dt.replace("T"," "); 

Upvotes: 2

Related Questions