RSS Forums RSS
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 9968 | Replies: 3
Reply
Join Date: Jun 2005
Posts: 6
Reputation: nccliang is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
nccliang nccliang is offline Offline
Newbie Poster

get current time

  #1  
Jul 14th, 2005
Sorry , one simple question how do i get the current time ?
In the sense of mm/dd/yy . My java is weak
I know must make use of the calendar class but im not too sure how it works
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2005
Location: india
Posts: 44
Reputation: cheenu78 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
cheenu78's Avatar
cheenu78 cheenu78 is offline Offline
Light Poster

Re: get current time

  #2  
Jul 14th, 2005
hi nccliang,

Probably this helps :

[HTML]
import java.util.*;
import java.text.*;
class TestDate
{
public static void main(String args[])
{
Date date=new Date();
SimpleDateFormat sdf=new SimpleDateFormat("MM/dd/yy");
String strDate=sdaf.format(date);
System.out.println(strDate);
}
}
[/HTML]
regards
Srinivas
We come to love not by finding a perfect person, but by learning to see an imperfect person perfectly.

-Sam Keen, from To Love and Be Loved
Reply With Quote  
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 19
Solved Threads: 200
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: get current time

  #3  
Jul 14th, 2005
If your Java skills are weak you need to improve those skills, not ask people for ready made solutions.
Get a good book (or 2, or 10, or like me buy them until you run out of money), read the API docs, and experiment.

DateFormat, Calendar, and Date together are extremely powerful but that makes the system a tad complex.
Aren't we lucky it's so well documented in the API docs then?
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote  
Join Date: Jun 2005
Location: over there... no, a bit more left than that
Posts: 56
Reputation: Easter Bunny is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
Easter Bunny's Avatar
Easter Bunny Easter Bunny is offline Offline
Junior Poster in Training

Re: get current time

  #4  
Jul 14th, 2005
Originally Posted by jwenting
Aren't we lucky it's so well documented in the API docs then?

that's why i don't like c++. doesn't have documentation like java. studying computer science through correspondence and i have to do that.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 12:52 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC