i have already used Simple Date Format method.i got the time from the system.that i am stored in sql.in sql i used datetime datatype.it gives date and time.but i need only time.and how to subtract the time.
How to calculate time in java
Collapse
X
-
1. declare a long type variable --> long lng;
2. assign it to time --> lng=System.curr entTimeMillis() ;
--> System.out.prin tln(lng);
import java.util.*;
class time
{
public static void main (String[] arg){
long lng;
lng=System.curr entTimeMillis() ;
System.out.prin tln(lng);
}
}
it'll print system time since 1980..........? ????Comment
-
That's why it's so comfortable to have all the API documents available locally:Originally posted by mahammadseerazit'll print system time since 1980..........? ????
kind regards,Originally posted by System API docsReturns the current time in milliseconds. Note that while the unit of time of the
return value is a millisecond, the granularity of the value depends on the
underlying operating system and may be larger. For example, many operating
systems measure time in units of tens of milliseconds.
See the description of the class Date for a discussion of slight discrepancies
that may arise between "computer time" and coordinated universal time (UTC).
Returns:
the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.
JosComment
-
Ok, what you're going to want to do is use JTable's getColumnModel( ) method and then afterwards use the TableColumnMode l's getColumn(index ) method. Then just set the preferred/max/min widths. Check out the following documentation on both of them:Originally posted by Ramkrishhi ,
Thank u for ur reply.Do u know how to increase the column width in JTable.
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTable.html
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/table/TableColumnMode l.html
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/table/TableColumn.htm l
I've done this before so though I know it's not the easiest concept, try it for yourself and tell me if you get stuck on a problem.
Good luck,
-blazedComment
Comment