The Time and Date Format Suffixes : Formatting Date Time « Development « Java Tutorial

Home
Java Tutorial
1.Language
2.Data Type
3.Operators
4.Statement Control
5.Class Definition
6.Development
7.Reflection
8.Regular Expressions
9.Collections
10.Thread
11.File
12.Generics
13.I18N
14.Swing
15.Swing Event
16.2D Graphics
17.SWT
18.SWT 2D Graphics
19.Network
20.Database
21.Hibernate
22.JPA
23.JSP
24.JSTL
25.Servlet
26.Web Services SOA
27.EJB3
28.Spring
29.PDF
30.Email
31.J2ME
32.J2EE Application
33.XML
34.Design Pattern
35.Log
36.Security
37.Apache Common
38.Ant
39.JUnit
Java Tutorial » Development » Formatting Date Time 
6.9.12.The Time and Date Format SuffixesPrevious/Next
Suffix                  Replaced By

a                       Abbreviated weekday name

A                       Full weekday name

b                       Abbreviated month name

B                       Full month name

c                       Standard date and time string formatted as day month date hh::mm:ss tzone year

C                       First two digits of year

d                       Day of month as a decimal (01-31)

D                       month/day/year

e                       Day of month as a decimal (1-31)

F                       year-month-day

h                       Abbreviated month name

H                       Hour (00 to 23)

I                       Hour (01 to 12)

j                       Day of year as a decimal (001 to 366)

k                       Hour (to 23)

l                       Hour (to 12)

L                       Millisecond (000 to 999)

m                       Month as decimal (01 to 13)

M                       Minute as decimal (00 to 59)

N                       Nanosecond (000000000 to 999999999)

p                       Locale's equivalent of AM or PM in lowercase

Q                       Milliseconds from 1/1/1970

r                       hh:mm:ss (12-hour format)

R                       hh:mm (24-hour format)

S                       Seconds (00 to 60)

s                       Seconds from 1/1/1970 UTC

T                       hh:mm:ss (24-hour format)

y                       Year in decimal without century (00 to 99)

Y                       Year in decimal including century (0001 to 9999)

z                       Offset from UTC

Z                       Time zone name
6.9.Formatting Date Time
6.9.1.Formatting Time and Date: The Time and Date Format Suffixes
6.9.2.%tr: Formatting time and date
6.9.3.%tc: Display complete time and date information
6.9.4.%tl:%tM: Display just hour and minute
6.9.5.%tB %tb %tm: Display month by name and number
6.9.6.Display 12-hour time format
6.9.7.Display 24-hour time format.
6.9.8.Display short date format.
6.9.9.Display date using full names.
6.9.10.Display complete time and date information: using %T rather than %t.
6.9.11.Display hour and minute, and include AM or PM indicator.
6.9.12.The Time and Date Format Suffixes
6.9.13.Display several time and date formats
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.