Results 1 to 7 of 7
Thread: How To Get The Date
- 07-19-2013, 11:49 PM #1
How To Get The Date
Salutations, my programming friends. It's been a while since I've made a thread. Been taking a break from life.
Quick question, how can you get Java to return the current date & time? I've heard of the Date (which has been deprecated) and Calendar classes, but you have to input information before it outputs date details to you. Is there a way for java to return the current date? Answers will be much appreciated!
- 07-19-2013, 11:56 PM #2
Re: How To Get The Date
Have a look at the API: Calendar (Java Platform SE 6)
- 07-20-2013, 12:00 AM #3
Re: How To Get The Date
The API is very convoluted, too detailed for me to find any brief information I'm looking for. I was wondering if any members here had any tips or methods they have for doing something so simple.
- 07-20-2013, 12:08 AM #4
Re: How To Get The Date
In the third paragraph of the API, it says:
Like other locale-sensitive classes, Calendar provides a class method, getInstance, for getting a generally useful object of this type. Calendar's getInstance method returns a Calendar object whose calendar fields have been initialized with the current date and time:
Java Code:Calendar rightNow = Calendar.getInstance();
- 07-20-2013, 12:12 AM #5
Re: How To Get The Date
Ahh, I was looking at the .getInstance() method, but I was outputting that by itself. Using that with the .getTime() method seems to generally give me a bit of what I was looking for.. I guess API's can be helpful when looked through properly. I still think they're overly complex though.
Thanks for the help, Toll!
- 07-20-2013, 09:36 PM #6
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: How To Get The Date
... so you were dead!?!? What was that like?
I've heard of the Date (which has been deprecated)
Is there a way for java to return the current date?
But impatience is highly destructive to programming, I'd work on that if I were you. Or perhaps drink less coffee?
- 07-20-2013, 10:07 PM #7
Similar Threads
-
Inserting current date to oracle Date data type
By bartolay13 in forum JDBCReplies: 5Last Post: 02-16-2012, 10:26 AM -
How can I know last access date & creation date for a file in java?
By Rami in forum Advanced JavaReplies: 4Last Post: 07-27-2011, 12:57 PM -
Is their any method which converts a Julian date to an actual date.
By renu in forum New To JavaReplies: 2Last Post: 05-12-2011, 05:52 PM -
Compare date input to database with current date
By hungleon88 in forum Advanced JavaReplies: 2Last Post: 11-25-2008, 09:10 AM -
Creating a Gregorian Calendar using a Date object gives date - 1
By prachi_goliwadekar in forum New To JavaReplies: 1Last Post: 05-08-2008, 09:32 PM
Bookmarks