localization - How to format a String with multiple dates in Java -


i format string contains patterns more 1 date/time. example:

'starting on' eeee 'at' h:mm 'and ending on' mmm d 

here trying use 2 dates in same format string, start date , end date. don't want split 2 strings because ordering , structure of sentence might different in other languages , don't want put assumptions code. far can tell can't done simpledateformat format() methods take 1 date object.

you can use java.text.messageformat has ways provide data format need.

string result = messageformat.format(      "at {1,time} on {1,date}, there {2} on planet {0,number,integer}.",      arguments); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -