English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

is there a way in java to get get local machine time (ie the time on my computer) and print it out so that it is in the format of say mon aug 15 08:52:39 2006.

I'v tried using the calendar class but all the values it returns are integers, for example instead of mondayit would return 2 and isnstead of aug it would return 8. I considered writing a few lines of code that convert theses integers to their relevant strings but this would be too long winded and i'm sure there's gotta be a more efficient way to it.

ps, what i'm trying to do is write a program which reads the time from another machine and mymachine then works out the differnece between the two times.

2006-08-14 02:05:06 · 2 answers · asked by sammyboywonder 2 in Computers & Internet Programming & Design

2 answers

You should use the DateFormat class: http://java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html

2006-08-14 02:13:56 · answer #1 · answered by Jody 3 · 0 0

See this question

2006-08-14 09:37:26 · answer #2 · answered by AnalProgrammer 7 · 0 0

fedest.com, questions and answers