Skip to content
Snippets Groups Projects
Commit e46f1abe authored by boqiren's avatar boqiren
Browse files

fix datetime error

parent 4fe00155
No related branches found
No related tags found
No related merge requests found
...@@ -325,13 +325,13 @@ public class MainActivity extends AppCompatActivity implements ...@@ -325,13 +325,13 @@ public class MainActivity extends AppCompatActivity implements
@Override @Override
public void onClick(View view) { public void onClick(View view) {
sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MONTH,true); sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MONTH,true);
sendUpdate(MQTT_TOPIC_DATETIME_MONTH,getDateTime()[1]); sendUpdate(MQTT_TOPIC_DATETIME_MONTH,getDateTime()[0]);
sendMqttUpdates.put(MQTT_TOPIC_DATETIME_DAY,true); sendMqttUpdates.put(MQTT_TOPIC_DATETIME_DAY,true);
sendUpdate(MQTT_TOPIC_DATETIME_DAY,getDateTime()[2]); sendUpdate(MQTT_TOPIC_DATETIME_DAY,getDateTime()[1]);
sendMqttUpdates.put(MQTT_TOPIC_DATETIME_HOUR,true); sendMqttUpdates.put(MQTT_TOPIC_DATETIME_HOUR,true);
sendUpdate(MQTT_TOPIC_DATETIME_HOUR,getDateTime()[3]); sendUpdate(MQTT_TOPIC_DATETIME_HOUR,getDateTime()[2]);
sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MINUTE,true); sendMqttUpdates.put(MQTT_TOPIC_DATETIME_MINUTE,true);
sendUpdate(MQTT_TOPIC_DATETIME_MINUTE,getDateTime()[4]); sendUpdate(MQTT_TOPIC_DATETIME_MINUTE,getDateTime()[3]);
//send preferences //send preferences
String userBrightness= drop2.getSelectedItem().toString(); String userBrightness= drop2.getSelectedItem().toString();
System.out.println(userBrightness); System.out.println(userBrightness);
...@@ -371,7 +371,7 @@ public class MainActivity extends AppCompatActivity implements ...@@ -371,7 +371,7 @@ public class MainActivity extends AppCompatActivity implements
//get input datas from mobil in system month //get input datas from mobil in system month
private String [] getDateTime(){ private String [] getDateTime(){
DateFormat df = new SimpleDateFormat("yy:MM:dd:HH:mm"); DateFormat df = new SimpleDateFormat("MM:dd:HH:mm");
String date = df.format(Calendar.getInstance().getTime()); String date = df.format(Calendar.getInstance().getTime());
String[] datetime_split= new String[5]; String[] datetime_split= new String[5];
datetime_split=date.split(":"); datetime_split=date.split(":");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment