Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
176
rated 0 times [  179] [ 3]  / answers: 1 / hits: 30899  / 11 Years ago, fri, june 21, 2013, 12:00:00

I have tried to implement the date picker in android. I want it to get the data and show it in the text format



  <html>
<head>
<script type=text/javascript charset=utf-8 src=cordova-2.5.0.js></script>
<script type=text/javascript charset=utf-8 src=datePickerPlugin.js></script>
<script type=text/javascript charset=utf-8>

function dateTest() {
var myNewDate = new Date();

window.plugins.datePicker.show({
date : myNewDate,
mode : 'date', // date or time or blank for both
allowOldDates : true
}, function(returnDate) {
var newDate = new Date(returnDate);
currentField.val(newDate.toString(dd/MMM/yyyy));

// This fixes the problem you mention at the bottom of this script with it not working a second/third time around, because it is in focus.
currentField.blur();
});
}
</script>
</head>
<body bgcolor=#ffffff>
<hr>DatePicker Test<hr><br>
<input type=button onClick =dateTest() value =Today's Date!! />
<div id=view></div>
</body>
</html>


I am getting it as an alert...but unable to store it as a string on the same page


More From » android

 Answers
22

Why loose ur head?



A <input type=date> will allways deppend on device's interpretation of it, in some android devices it doesn't even work,



There is plenty of plugins, addons, whatever, for it,



I personally like, and use mobiscroll: Link



Edit: Mobiscroll is now paid but there are loads of free frontend mobile frameworks and probably all of them have a datepicker, such as jQuery Mobile-datepicker.


[#77502] Thursday, June 20, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
blair

Total Points: 384
Total Questions: 108
Total Answers: 86

Location: Northern Ireland
Member since Tue, May 5, 2020
4 Years ago
blair questions
Sat, Feb 12, 22, 00:00, 2 Years ago
Wed, Aug 25, 21, 00:00, 3 Years ago
Sat, Jul 10, 21, 00:00, 3 Years ago
Tue, Aug 25, 20, 00:00, 4 Years ago
;