I have a Java date object. How it should be converted (I mean string presentation) to be displayed as HTML
:
<input type='time' ng-model='myTimeFromServer'/>
myTimeFromServer
in ng-model
is String from server new Date().toString()
I need to use input
because it is predefined value that user can change.
Thanks in advance!
The java date object needs to be formatted to string in the format you want. Below is snippet of code to format date in format 'dd/MM/yyyy' using SimpleDateFormat.
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String formattedDate = sdf.format(new Date());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.