A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
How does a parse method in Date class work
Joined: Mar 16, 2005
Jun 16, 2005 14:45:00
hai guys , how does a parse method of a date class work, i am totally confused how does it work.
plz check out this program and plz help me how does the parse method works
public class DateProg
ParsePosition p = new ParsePosition(0);
SimpleDateFormat sdate=new SimpleDateFormat("yyMMdd");
Date dt = sdate.parse(date,p);
Joined: May 20, 2005
Jun 16, 2005 16:55:00
So what results do you get when you run this program? I would change the method signature of your method to:
public static void main (String args)
and add a semicolon after 050716.
Let me know if what you get is what you intended.
-Rich, SCJP 1.4
I agree. Here's the link:
subject: How does a parse method in Date class work
How to print default date in required format
string to date conversion problem
Best Way to parse a string to a unexpectable Date Format
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014