Seconds since when? Since 01-01-2000? Since the beginning of the CE? If
the former, how about GregorianCalendar.get(Calendar.DAY_OF_YEAR) and
multiplying that times the number of seconds in a day (left as an exercise
to the reader...8-).
BTW, using Date.getSeconds() is a no-no (and wouldn't help anyway because it
returns the number of seconds in the time, if any) because it is deprecated.
----- Original Message -----
From: Silvia Gaspar <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 17, 2000 3:42 AM
Subject: still date manipulation
> 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
>
___________________________________________________________________________
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