 |
|
Code (Android-Java)
Calendar cal = Calendar.getInstance();
Calendar new_cal = Calendar.getInstance();
sTime = (String) android.text.format.DateFormat.format("hh:mm",cal.getTimeInMillis());
String[] time =sTime.split(":");
String h = time[0];
hour = parseInt(h);
String m = time[1];
minute = parseInt(m);
sDate = (String) android.text.format.DateFormat.format("yyyy-MM-dd" ,cal.getTimeInMillis());
String[] date =sDate.split("-");
String d = date[2];
String y = date[0];
String mo = date[1];
day = Integer.parseInt(d);
new_cal.set(Calendar.HOUR_OF_DAY, 17);
new_cal.set(Calendar.MINUTE, 30);
new_cal.set(Calendar.YEAR, Integer.parseInt(y));
new_cal.set(Calendar.MONTH, Integer.parseInt(mo)-1);
new_cal.set(Calendar.DAY_OF_MONTH, day);
Log.d("swf", (String) android.text.format.DateFormat.format("yyyy-MM-dd hh:mm",new_cal.getTimeInMillis()));
dateTime = (String) android.text.format.DateFormat.format("yyyy-MM-dd hh:mm",new_cal.getTimeInMillis());
sql_medicine = "INSERT INTO medic_time (md_id,md_name,time_alarm) VALUES ('"+c.getString("md_id")+"','"+c.getString("md_name")+"','"+dateTime+"')";
Log.d("sql", sql_medicine);
mDb.execSQL(sql_medicine);

Tag : Mobile, Android, JAVA
|
|
 |
 |
 |
 |
Date :
2014-02-17 16:10:52 |
By :
Knighterrant |
View :
1324 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |