Skip to content
Advertisement

Show the current date in a Datepicker

I have two questions; my app has 2 textview datepickers, both of which I will use for a record.

My problem is:

1.- How can I do so that when displaying the datepicker (the box to choose the date); the current date is selected.

2.-How can I validate the start date with the end date according to my code; or in what way can I do it.

[enter image description here][1] [1]: https://i.stack.imgur.com/nYhiq.jpg

Start date

JavaScript

End Date

JavaScript

Advertisement

Answer

Answer of 1: Use GregorianCalendar instead of Calender like following:

JavaScript

Answer of 2: Hide older date from start date into end date DatePicker

JavaScript

Hope this is helpful.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement