This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to convert string to int in jsp?

 
amanda wu
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or how to convert string to calender object ?
i want to convert dates (yy/mm/dd/hr/min/sec) to unix time
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the standart methods from api ... like
Integer.parseInt(String) and so on...
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13062
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a date string in a nice consistent format, you can use the java.text.SimpleDateFormat class to parse it into a Date object. You can use the Date object method getTime() to get the UNIX milliseconds.
SimpleDateFormat is not all that simple but it is very general. For example..

can parse a date string like this:
"11/25/02 3:47:17 PM CST"
Bill
 
amanda wu
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
many thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic