please i want to convert string to datetime by using jsp and i hope to any one replay

Example

String s="mm/dd/yyyy"

to

Datetime s1=s:?: :?: :?: :?: :?:

JSTL contains formating tags.
If that's not enough for what you want you shouldn't use JSP for it.

use
DateTime.parseDateTime(String)
or
DateTime.parseDate(String)

Each will return a DateTime object from a string in a standard format... if it doesn't inderstand the string it will throw a NumberFormatException

Peace,

You can use SimpleDateFormat class also.
String s="mm/dd/yyyy"

Date d = new Date();
SimpleDateFormat st = new SimpleDateFormat(s);
st.format(d);

You guys are missing the point, this person wants to go other way... they have a date, in a string they want to get the timestamp object that equals that date.... not the other way around...

SimpleDateFormat reads a date format from a string that contains formatting codes and then allows you to turn a date object into a string that displays in the format you setup... great but that is "Date to String"
They want to go from "String to DateTime"... That is quite a bit different...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.