List objList = null;
objList = new ArrayList ();
Timestamp a = General.ToDate (General.convertStringToDate (m, "yyyy-MM-dd"));
objList.add (a);
objList.add (General.convertDateToTimestamp (General.convertStringToDate (m, "yyyy-MM-dd")));
above two methods which add to objList not work, I can add the application tracking type String , is not add Timestamp type, seeking god help the next Manga, first thanked you for the.
------ Solution ---------------------------------------- ----
add the parameter type is Object, can be added . You see if it is another error.
------ Solution ---------------------------------------- ----
your problems elsewhere , right ?
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class ListTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
List objList = null;
objList = new ArrayList();
Timestamp a = new Timestamp(new Date().getTime());
objList.add(a);
}
}
------ For reference only ----------------------------------- ----
with generics
List
Date date = new Date ();
Timestamp time = new Timestamp (date.getTime ());
list.add (time);
------ For reference only --------------- ------------------------
is not your time packet error import it ?
------ For reference only -------------------------------------- -
been resolved, thank you ah
Error:
my program m = '2012 Year March 22 ' ;
General.convertStringToDate (m, "yyyy-MM-dd")
conversion error saying it can not be converted , in the preceding first m converted to '2012 -03-22 ' format just fine.
now do not understand is why there can not be directly converted to m . But the program has been good .
Thank you ah
没有评论:
发表评论