get Time String in year.month.day.hour.minute.second format - Android java.util

Android examples for java.util:Date Time

Description

get Time String in year.month.day.hour.minute.second format

Demo Code

import android.text.format.Time;

public class Main {

  /**/*  w ww .  j  a va2  s. c om*/
   * @return type:"year.month.day.hour.minute.second" Use String.split("."); to
   *         get each of time item.
   */
  public static String getTimeString() {
    Time time = new Time();
    time.setToNow();
    return time.year + "." + time.month + "." + time.monthDay + "." + time.hour + "." + time.minute + "." + time.second;
  }

}

Related Tutorials