|
|
Log In | ||
Discussion by shanker7 with 1 Replies.
Last Update: August 24, 2011, 10:58 pm | |||
![]() |
|
|
Hi,
Friends this is shanker...
Can anybody please post me the java code which can store the system time when click on some button...
Friends this is shanker...
Can anybody please post me the java code which can store the system time when click on some button...
You ought to look up the Java API documentation to learn to do this. According to the API documentation, the java.util.Date constructor "initializes it so that it represents the time at which it was allocated," which means that you can do something like this: java.util.Date dt1 = new java.util.Date();
Put the constructor call in an action handler for a button, declare the variable as a member variable of the class, and if you need to display the date anywhere, call the toString() method on the date object. If you want to have more control over how the date is displayed, take a look at the java.text.DateFormat class and, more specifically, the format method of the DateFormat class. You can also build the date string by obtaining the date parts using the java.util.Calendar class. The Calendar.get method takes a parameter that you can specify as "java.text.Calendar." followed by DAY_OF_MONTH, MONTH, YEAR, HOUR_OF_DAY, MINUTE, SECOND.
Use the auto-complete of your Java IDE to help you with finding the other methods for the Date and Calendar classes.
Put the constructor call in an action handler for a button, declare the variable as a member variable of the class, and if you need to display the date anywhere, call the toString() method on the date object. If you want to have more control over how the date is displayed, take a look at the java.text.DateFormat class and, more specifically, the format method of the DateFormat class. You can also build the date string by obtaining the date parts using the java.util.Calendar class. The Calendar.get method takes a parameter that you can specify as "java.text.Calendar." followed by DAY_OF_MONTH, MONTH, YEAR, HOUR_OF_DAY, MINUTE, SECOND.
Use the auto-complete of your Java IDE to help you with finding the other methods for the Date and Calendar classes.
Similar Topics:
Cant Log In
Is It Just Me Or Does Trap17 Has A ...
Trying To Log In To Xisto Support
Txtweb App2Fame Contest For Developers In India (0)
|
(1) Diffrence Between Jsp And Java Script
|
Loading...
HOME 






