• 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 Display In MM/dd/yyyy

 
Greenhorn
Posts: 23
Firefox Browser Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I Want To Conert Date Into Format MM/dd/yyyy. I Write Code But After Executing t Displays The Date In Long Date Format.
The Code Written By Me Is...






Please Suggest What Is Wrong....
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See, what does "dateFormat1" string prints ?
 
kishukishor patil
Greenhorn
Posts: 23
Firefox Browser Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank's For Reply

It Is Right. Upto dateFormat1 it prints in string format and in right format. but after pasing it is again converted in long date format. I Don't want that. I Only Want The Date Which Is In String Format As It Is In Date Format Also...


 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

kishukishor patil wrote:I Only Want The Date Which Is In String Format As It Is In Date Format Also...


So don't re pass the the "formatted" date string back to the data object agian. Just stop when you formate the date object into the string. What are you doing now is, something like this.
 
kishukishor patil
Greenhorn
Posts: 23
Firefox Browser Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But Want It Into Date. Or Current Date In Formated (MM/dd/yyyy) Form. How Can I Do That...

 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't have a "Date" object in formated form. Formatter comes when you want to "print" that date object. BTW, what do you want to do with that Date object?
 
kishukishor patil
Greenhorn
Posts: 23
Firefox Browser Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I Want To Pass That Date Object To An Setter Method Which has a date as parameter. But I Want To Set That DAte In PreFormatted Form...
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, no need to format the date object, you can't format the "Data" class, if you still want one, try implementing your own ;) AND you can anytime pass the date object to your setter method, don't worry about its format
And I repeat,

Formatter comes when you want to "print" that date object

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I Want To Set That DAte In PreFormatted Form...


Since Date objects don't have any notion of a format -as Sagar pointed out- you'll need to pass a formatted String, or create the formatted string from the Date object where you actually need it.
 
kishukishor patil
Greenhorn
Posts: 23
Firefox Browser Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank's To all....
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic