• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Date - easy question, make yourself feel good

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very quick question - I want to convert the format of a date/time. I retrieve a msec value from a database, but instead of displaying it as a msec value in an html page, I want to display it as a normal time (e.g. 12:22). I have managed to display it as a full date and time (that is, Sun Jul 14 12:22:03 GMT 2001). However, I only want to show the time 12:22, not the date and timezone. How do I go about this.
Thanks,
James
 
James Hewitt
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, that was very easy! Just worked it out myself. I'm getting better (slowly) at this.
Thanks,
James
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SimpleDateFormat dateFormat = new SimpleDateFormat("h:mm a");
dateFormat.format(new java.util.Date());
I hope that works for you =)
 
Rehan Malik
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Delete your post that you got it. I wanna feel good =)
 
reply
    Bookmark Topic Watch Topic
  • New Topic