Hello again

I'm still wondering how I can turn a given date (string format given by a
user) in to seconds. If someone could give me an example. I tried the
following code but it doesn't work:

import java.awt.*;
import java.applet.*;
import java.util.GregorianCalendar;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.text.*;

public class Applet1 extends Applet
{
        public void init()
        {
                long sec;

                try{
                        DateFormat dfCurrentDate = new
SimpleDateFormat("dd-mm-yyyy");
                        dfCurrentDate.setLenient(false);
                        Date dDate = dfCurrentDate.parse("16-08-2000");
                        GregorianCalendar calendar = new
GregorianCalendar();

                        calendar.setTime(dDate);
                        sec = calendar.getTime().getSeconds();
                }catch(ParseException pe)
                {
                        String str = pe.getMessage();
                }
        }
}


thank you

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to