Hi All, I am wondering if there is any method allow you to get hour, minutes, second, year, month and date from any format of datetime? Here is an example to get the date and time, is there any method to split them? Date now = new Date(); DateFormat formatter = DateFormat.getDateTimeInstance( DateFormat.LONG, DateFormat.MEDIUM); strStartDateTime = formatter.format(now); System.out.println("Right now is: " + strStartDateTime); The output is like that: July 18, 2001 11:22:26 AM Thank you!
Check out the GregorianCalendar class. You can get whatever you want. Here is an example for you: import java.util.*;
Alternately, if you really want to use the Date class, you could create your on methods for getting the hour, min, sec, etc., by parsing the string to get these values, but if you are in a hurry I would just use this. Hope this helps! Barry
[This message has been edited by Barry Andrews (edited July 18, 2001).]