Results 1 to 2 of 2
- 10-20-2011, 09:31 AM #1
Member
- Join Date
- Oct 2011
- Posts
- 2
- Rep Power
- 0
Date value passed to a web service
Hi everyone,
I'm building an Android app and need to pass a date value into a web service. I've created a standard date variable that grabs the current date and time, then used the SimpleDateFormat method to convert it into a String of my desired format but then I need to convert that string back to a date object so it can be given to the web service.
I've tried the following however it doesn't convert utilDate into the desired format?;
java.util.Date utilDate = null;
Date rightNow = new Date();
String TodayDate;
SimpleDateFormat dateformatMddyyyy = new SimpleDateFormat("M-dd-yyyy");
StringBuilder nowMddyyyy = new StringBuilder( dateformatMddyyyy.format( rightNow ) );
TodayDate = nowMddyyyy.toString();
try {
utilDate = dateformatMddyyyy.parse(TodayDate);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I'm very new to Java so I appologise if there is a glaringly obvious way to do this!
- 10-20-2011, 10:46 AM #2
Member
- Join Date
- Oct 2011
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Inserting current date to oracle Date data type
By bartolay13 in forum JDBCReplies: 5Last Post: 02-16-2012, 09:26 AM -
How can I know last access date & creation date for a file in java?
By Rami in forum Advanced JavaReplies: 4Last Post: 07-27-2011, 11:57 AM -
entities are passed by value or passed by reference
By syntrax in forum New To JavaReplies: 1Last Post: 12-17-2009, 07:13 AM -
how to call service method inside another service
By kirtichopra2003 in forum Web FrameworksReplies: 1Last Post: 10-24-2009, 02:19 AM -
Compare date input to database with current date
By hungleon88 in forum Advanced JavaReplies: 2Last Post: 11-25-2008, 08:10 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks