• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Date Format (e.g. Tuesday 28th September 2010) Issue

 
Ranch Hand
Posts: 153
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All ,

Can anyone suggest how to get the date format like "Tuesday 28th September 2010" or "Saturday 1st January 2010" in java .


Thanks in advance to all of you for your suggestion.

Regards,
Chetan.
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at JavaDatesFaq
 
Karn Kumar
Ranch Hand
Posts: 153
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya Mohamed,

There are various format which are useful but not exactly what we want like (e.g. Tuesday 28th September 2010).Do we need to explicitly mention (like "th" in the "28th") in the array for each from 1 to 31 so we can use that.

Regards,
Chetan.

 
Marshal
Posts: 77217
370
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should find something useful in the documentation for Formatter. There is also this class, but it appears to be a Swing class, so probably less useful.

You may have to write your own utility method to get "th": remember 1 21 31 = "st" 2 22 = "nd" 3 = "rd" remainder = "th". If you get the 33rd of the month, you have got problems
 
Sheriff
Posts: 22716
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
12 -> twelfth, not twelveth. There are always exceptions.
 
Campbell Ritchie
Marshal
Posts: 77217
370
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but he wants to print "12th" not "twelfth".
 
Rob Spoor
Sheriff
Posts: 22716
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah right. Then ignore my previous post.
 
Karn Kumar
Ranch Hand
Posts: 153
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to all of you guys for your cooperation
 
reply
    Bookmark Topic Watch Topic
  • New Topic