• Post Reply Bookmark Topic Watch Topic
  • New Topic

Date - easy question, make yourself feel good

 
James Hewitt
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Sorry, that was very easy! Just worked it out myself. I'm getting better (slowly) at this.
Thanks,
James
 
Rehan Malik
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Delete your post that you got it. I wanna feel good =)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!