Date formatting

This gives an overview of how to specify date formats in ROB-EX. Dates are constructed with a string that specifies a pattern for the dates to be formatted and/or parsed. The characters in below table can be used in date formats. Where appropriate, 4 or more of the character will be interpreted to mean that the long format of the element should be used, while fewer than 4 mean that a short format should be used.

Example 1: ‘dd-MM-yyyy’ will result in “02-11-2009”

Example 2: ‘dd-MMM-yyyy’ will result in “02-Nov-2009”

Example 3: ‘dd-MM-yy HH:mm’ will result in “02-11-09 23:02”

Example 4: ‘yy/MM/dd h:mm aa’ will result in “09/11/02 11:02 PM”

Symbol Meaning Type Example
G Era Text ″GG″ -> ″AD″
y Year Number ″yy″ -> ″03″
″yyyy″ -> ″2003″
M Month Text or Number ″M″ -> ″7″
″M″ -> ″12″
″MM″ -> ″07″
″MMM″ -> ″Jul″
″MMMM″ -> ″December″
d Day in month Number ″d″ -> ″3″
″dd″ -> ″03″
h Hour (1-12, AM/PM) Number ″h″ -> ″3″
″hh″ -> ″03″
H Hour (0-23) Number ″H″ -> ″15″
″HH″ -> ″15″
k Hour (1-24) Number ″k″ -> ″3″
″kk″ -> ″03″
K Hour (0-11 AM/PM) Number ″K″ -> ″15″
″KK″ -> ″15″
m Minute Number ″m″ -> ″7″
″m″ -> ″15″
″mm″ -> ″15″
s Second Number ″s″ -> ″15″
″ss″ -> ″15″
S Millisecond (0-999) Number ″SSS″ -> ″007″
E Day in week Text ″EEE″ -> ″Tue″
″EEEE″ -> ″Tuesday″
D Day in year (1-365 or 1-364) Number ″D″ -> ″65″
″DDD″ -> ″065″
F Day of week in month (1-5) Number ″F″ -> ″1″
w Week in year (1-53) Number ″w″ -> ″7″
W Week in month (1-5) Number ″W″ -> ″3″
a AM/PM Text ″a″ -> ″AM″
″aa″ -> ″AM″
z Time zone Text ″z″ -> ″EST″
″zzz″ -> ″EST″
″zzzz″ -> ″Eastern Standard Time″
text within ‘ Escape for text Delimiter ″‘hour’ h″ -> ″hour 9″
'' Single quote Literal ″ss’‘SSS″ -> ″45′876″

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment