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

Recommended Answers

All 3 Replies

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

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?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.