Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

How do I display the current time *including milliseconds*?

Thread view: 
Al Koch - 25 Jun 2005 21:37 GMT
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,
AlKoch@MyRealBoxREMOVEALLTHESECHARS.com
Raymond DeCampo - 25 Jun 2005 21:56 GMT
> How do I display the current time *including milliseconds*?

Take a look at java.util.SimpleDateFormat.

HTH,
Ray

Signature

XML is the programmer's duct tape.

Al Koch - 27 Jun 2005 06:22 GMT
Hi Ray,

> Take a look at java.util.SimpleDateFormat.

Thanks very much; that was exactly what I needed!  (although it's actually
java.text.SimpleDateFormat).

Al,
AlKoch@MyRealBoxREMOVEALLTHESECHARS.com
Raymond DeCampo - 27 Jun 2005 13:41 GMT
> Hi Ray,
>
>>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

Signature

XML is the programmer's duct tape.

Joly Makunga - 30 Jun 2005 10:40 GMT
> How do I display the current time *including milliseconds*?
>
[quoted text clipped - 21 lines]
> Al Koch,
> AlKoch@MyRealBoxREMOVEALLTHESECHARS.com

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.