Hey Travis,

Try the following...

// Establish a Date object for the current system date
java.util.Date currentDate = new java.util.Date();

// Set up a SimpleDateFormat object
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");

// Format the current date by the SimpleDateFormat object parameter
String dateString = sdf.format(currentDate);


Additional info can be found at the following links...

http://www.dataoncall.com/snippets/java/Calendar.getinstance().jsp
http://www.dataoncall.com/snippets/java/SimpleDateFormat().jsp


Hope all this helps ya!

Best regards,

Mike Cronin
Data On Call


-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Falls, Travis D (CASD, IT)
Sent: Thursday, September 19, 2002 12:31 PM
To: [EMAIL PROTECTED]
Subject: Dates in java


I am trying to get the current date and time and return it in as string.

I know I have to use Calendar.getInstance() and java.text.DateFormat.  Any
one have any sample code to do this?


This communication, including attachments, is for the exclusive use of
addressee and may contain proprietary, confidential or privileged
information. If you are not the intended recipient, any use, copying,
disclosure, dissemination or distribution is strictly prohibited. If
you are not the intended recipient, please notify the sender
immediately by return email and delete this communication and destroy all
copies.

___________________________________________________________________________
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