Tuesday, 23 October 2018

java - How to get date picker date in to text field?




Date Date1 = jXDatePicker1.getDate();
datestartField.setText(Date1);


Hint: String cannot be converted to date.


Answer



date can not assign to textfield as it is object .You can convert it in String using SimpledateFormat




    Date Date1 = jXDatePicker1.getDate();
DateFormat df = new SimpleDateFormat("dd MMM yyyy hh:mm a",
Locale.US);
datestartField.setText(df.format(date1));


Hope so it will help you..


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...