Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Time

Status
Not open for further replies.

bunnyweb

MIS
Jan 13, 2003
42
IE
Hi. I am hoping someone out there can help me.

I am querying on a date/time field in MS Access and receiving a value back that looks something like:

1899-12-30 15:45:00

I would like the above to return:

3:45 PM

I have looked up the Java Time class, but that doesn't seem to be getting me anywhere.

Any suggestions on how I might do this?

Thanks!

Rachel :)
 
Remember that java.sql.Date extends java.util.Date

Code:
class TimeDisplayTest{
	
	static void test( java.util.Date dt){
		java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("hh:mm a");
		String str = sdf.format(dt);
		System.out.println( str);
	}
}

-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top