Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Converting Date Into Milliseconds?  RSS feed

 
Chris Cairns
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to convert the following date and time into milliseconds: 4/21/2003 21.50. I know how to convert milliseconds into a date, but not the other way around. Could someone, please, help?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use a java.text.SimpleDateFormat object to create a Date object - the Date object has the getTime() method that returns milliseconds.
Bill
 
Chris Cairns
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I'm currently trying the following code, but am getting a exception.

[ May 02, 2003: Message edited by: Chris Cairns ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How much added effort would it take to include at least the name of the Exception you are getting? My mind reading capabilities extend only to the next room.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!