and then you can use this code to display and date format you want ;).

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateFormatTest
{
  public static void main( String[] cmdArgs ) throws Exception
  {
    SimpleDateFormat sdfInput = new SimpleDateFormat( "yyyy-MM-dd" );
    SimpleDateFormat sdfOutput = new SimpleDateFormat ("MM/dd/yyyy");
    SimpleDateFormat sdfRequOutput = new SimpleDateFormat ("dd-mm-yyyy");
    String textDate = "2001-01-04";

    Date date = sdfInput.parse( textDate );
    System.out.println(date);
    System.out.println( sdfOutput.format( date ) );
    System.out.println( sdfInput.format(date));
    System.out.println( sdfRequOutput.format(date));
    System.out.println( sdfOutput.format(sdfInput.parse(textDate)));


  } // main
} // class DateFormatTest

Regards, 
Vikramjit Singh, 
GTL Ltd. 
Ph. 7612929-1059



> -----Original Message-----
> From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 19, 2002 4:20 AM
> To: [EMAIL PROTECTED]
> Subject: Re: System.currentTimeMillis()
> 
> 
> That would be
> 
> String time = new Timestamp( System.currentTime.millis()).toString();
> 
> Now you can display it in your JSP.
> 
> Mark
> 
> -----Original Message-----
> From: Christian Petersen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 19, 2002 6:10 AM
> To: [EMAIL PROTECTED]
> Subject: SV: System.currentTimeMillis()
> 
> 
> You could use:
> 
> java.sql.Timestamp = new java.sql.Timestamp(long time);
> 
> Med Venlig Hilsen / Regards
> 
> Christian Petersen
> Lead Programmer, Partner
> Ipeople Aps
> Vester Voldgade 87, 4, DK-1552 Copenhagen
> 
> Streaming Media Partner . Advanced Web Development . Graphics Design
> --------------------------------------------------------------
> ----------
> ----
> Contact :  [EMAIL PROTECTED]
> On wwweb        :  www.ipeople.dk / www.mediastream.dk
> --------------------------------------------------------------
> ----------
> ----
> Phone :+101101 10000001011011101101010101|+3^2*5 3*11310023
> |(+4533930069)
> Mobile:+101101 1011010000101011110100110 |+3^2*5 2*37*319127
> |(+4523615398)
> --------------------------------------------------------------
> ----------
> ---- 
> 
> -----Oprindelig meddelelse-----
> Fra: A mailing list for discussion about Sun Microsystem's 
> Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]] På vegne af
> Anders Jørvad (RWDK)
> Sendt: 19. september 2002 12:04
> Til: [EMAIL PROTECTED]
> Emne: System.currentTimeMillis()
> 
> Hi all.
> 
> have a table in my database where i register the time of 
> creation for a
> record.
> This field is set = System.currentTimeMillis()
> 
> Now when the user gets the record displayed in he browser he gets af
> lagre
> number for display.
> I want to convert the number into the time and date for creation, but
> can't
> find a method for doing so
> i have tryed to use date() and time() but without any look???????
> 
> Regards
> 
> Anders
> 
> ______________________________________________________________
> __________
> ___
> 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

___________________________________________________________________________
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

Reply via email to