I am doing a Java mobile program using J2ME.
I want to save date time field value into a Mysql, I am trying to convert the datetime field into a long and saving it in Mysql if its possible.
In c# ToFileTime() method which does it, is there anything like that in J2ME??
public DateField getDateField() {
if (dateField == null) {
// write pre-init user code here
dateField = new DateField("dateField", DateField.DATE_TIME);
dateField.setDate(new java.util.Date(System.currentTimeMillis()));
// write post-init user code here
long myFileTime = dateField.
}
return dateField;
}
you need to correct 2 lines
//no need to pass system current time. new Date() creates current time date
dateField.setDate(new java.util.Date());
// gettime returns time in millis
long myFileTime = dateField.getDate().getTime();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.