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" <email@example.com> wrote in message news:firstname.lastname@example.org...
> 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!
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center