getting the data in java
I'm having trouble finding the function that returns the current date as a
string in a java application. If I can find this out I will then convert
it to an integer and use it in my program, but I need some suggestions on
how to get the date as a string.
Re: getting the data in java
The current date/time can be found by invoking the
System.currentTimeMillis() method (java.lang.System class). This of course
returns the date in its internal format which is a long. The Java API
separates the internal storage of current date/time from the formatting and
display, which can be accomplished by using the java.text.SimpleDateFormat
class. Use the long obtained from the method invoked above, in conjunction
with the SimpleDateFormat class and you can display a String representation
of date/time, or any part thereof, in about any format you can think of.
Hope that helps.
DevX Section Leader
"mike" <firstname.lastname@example.org> wrote in message news:email@example.com...
> I'm having trouble finding the function that returns the current date as a
> string in a java application. If I can find this out I will then convert
> it to an integer and use it in my program, but I need some suggestions on
> how to get the date as a string.
> Please Help!
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL