Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
Date & Time
Mathavan Balakrishnan
Greenhorn
Posts: 15
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi friends
I want to know how to get the system date and time.
Can u tell me the method and class used for that ?
Waiting for ur reply.
Christophe Verré
Sheriff
Posts: 14691
16
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Have a look at classes like GregorianCalendar and Calendar.
[My Blog]
All roads lead to JavaRanch
Jesper de Jong
Java Cowboy
Posts: 16084
88
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
import java.util.Date; public class ShowTheDate { public static void main(String[] args) { Date now = new Date(); System.out.println("The current date and time: " + now); } }
If you want the output in a specific format, have a look at class java.text.SimpleDateFormat.
Jesper's Blog
-
Pluralsight Author Page
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
What is the Data Type for GMT Date and Time?
advanced calculator
how to convert String into Date format
Date question
displaying time
More...