• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Date formatting in java.

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

i get a date value from My sql database(the field name start_date with data type "date").Also i insert the date value in following format yyyy-mm-dd format.i want to display in mm-dd-yyyy format .

i display the date value in the following format 2008-10-22 00:00:00.0.i want onlu mm-dd-yyyy format .please help
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there, welcome to Java ranch. This question probably belongs in the Beginners Forum (and if you search there you'll find many answers to this question) but regardless of that:

Look at the DateFormat class(es) in particular SimpleDateFormat, you'll quickly see what to use.

Hope that helps!
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by nazir ahmed:
Hi,

i get a date value from My sql database(the field name start_date with data type "date").Also i insert the date value in following format yyyy-mm-dd format.i want to display in mm-dd-yyyy format .

i display the date value in the following format 2008-10-22 00:00:00.0.i want onlu mm-dd-yyyy format .please help



Yes that's right!!!

You can achieve this by using SimpleDateFormat class and pass whatever format you want in it's constructor
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic