Discussion:
How do I display the current time *including milliseconds*?
(too old to reply)
Al Koch
2005-06-25 20:37:47 UTC
Permalink
How do I display the current time *including milliseconds*?

Hello,

I need to display the current time including milliseconds. The following
code:

DateFormat dfDateTimeStartupThread =
DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL,Locale.getDef
ault());
String sDateTimeStartupThread = dfDateTimeStartupThread.format(new Date());
System.out.println(sDateTimeStartupThread);

results in output like:

June 25, 2005 1:23:18 PM EST

which is nicely formatteed but I cannot find any way to get the milliseconds
to display.

How can this be done?

Thanks,
Al Koch,
***@MyRealBoxREMOVEALLTHESECHARS.com
Raymond DeCampo
2005-06-25 20:56:20 UTC
Permalink
Post by Al Koch
How do I display the current time *including milliseconds*?
Take a look at java.util.SimpleDateFormat.

HTH,
Ray
--
XML is the programmer's duct tape.
Al Koch
2005-06-27 05:22:50 UTC
Permalink
Hi Ray,
Post by Raymond DeCampo
Take a look at java.util.SimpleDateFormat.
Thanks very much; that was exactly what I needed! (although it's actually
java.text.SimpleDateFormat).

Al,
***@MyRealBoxREMOVEALLTHESECHARS.com
Raymond DeCampo
2005-06-27 12:41:12 UTC
Permalink
Post by Al Koch
Hi Ray,
Post by Raymond DeCampo
Take a look at java.util.SimpleDateFormat.
Thanks very much; that was exactly what I needed! (although it's actually
java.text.SimpleDateFormat).
Of course, I make that mistake every time...

Ray
--
XML is the programmer's duct tape.
Joly Makunga
2005-06-30 09:40:47 UTC
Permalink
Post by Al Koch
How do I display the current time *including milliseconds*?
Hello,
I need to display the current time including milliseconds. The following
DateFormat dfDateTimeStartupThread =
DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL,Locale.getDef
ault());
String sDateTimeStartupThread = dfDateTimeStartupThread.format(new Date());
System.out.println(sDateTimeStartupThread);
June 25, 2005 1:23:18 PM EST
which is nicely formatteed but I cannot find any way to get the milliseconds
to display.
How can this be done?
Thanks,
Al Koch,
i do it like that

Date madate=new Date();

int heure=madate.getHours();
int minute=madate.getMinutes();
int jour=madate.getDate();

i don't know how to get millisecondes...

jolyqr

Loading...