Recognize the time in my hourly belt.



  • How do you know the current time in my hourly belt? What about UTC-0?



  • That's what you did to test:

    TextView time = (TextView) findViewById(R.id.time);
    

    SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
    dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00"));
    time.setText(dateFormat.format(new Date()));

    GMT+00 here is like UTC in this context. For example, if you want to put UTC+3, then:

    dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+03"));




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2