1

Is there any way to get input type=date value to javascript date function?

I have used in HTML:

<input type=date ng-model="dueDate">
<input type="time" ng-model="dueTime">
<button class="button button-block" ng-click="upload_duedates(dueDate, dueTime)">Add duedates</button>

In controller inside upload_duedates function I am getting this:

dueDate = Thu Jun 24 1999 00:00:00 GMT+0530 (India Standard Time)
dueTime = Thu Jun 24 1999 00:00:00 GMT+0530 (India Standard Time)

But I have to change this date format to something like:

dueDate = 24/01/1999 or 24-jan-1999(only dd, mm, yyyy)
dueTime = 00:00:00 (only HH:mm:ss)

Is there any filter/directives in angularjs or any way to solve this?

2

1 Answer 1

1

There are many source in the web to show that. E.g. http://www.angulartutorial.net/2014/04/date-filtering-and-formatting-in.html

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I got a solution from your link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.