0

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

4
Contributors
3
Replies
4
Views
12 Years
Discussion Span
Last Post by Easter Bunny
0

hi nccliang,

Probably this helps :

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);
	}
}

regards
Srinivas

0

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?

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.