Exemple #1
0
 // Generates String for Traffic Info Screen
 protected String getTrafficString() {
   Calendar time = Calendar.getInstance();
   time.setTime(savedSince);
   return (Util.makeTwo(time.get(Calendar.DAY_OF_MONTH))
       + "."
       + Util.makeTwo(time.get(Calendar.MONTH) + 1)
       + "."
       + time.get(Calendar.YEAR)
       + " "
       + Util.makeTwo(time.get(Calendar.HOUR_OF_DAY))
       + ":"
       + Util.makeTwo(time.get(Calendar.MINUTE)));
 }
Exemple #2
0
  public static String getLocalDateString(long gmtDate, boolean onlyTime) {
    if (0 == gmtDate) return "***error***";
    int[] localDate = createDate(gmtTimeToLocalTime(gmtDate));

    StringBuilder sb = new StringBuilder(16);

    if (!onlyTime) {
      sb.append(Util.makeTwo(localDate[TIME_DAY]))
          .append('.')
          .append(Util.makeTwo(localDate[TIME_MON]))
          .append('.')
          .append(localDate[TIME_YEAR])
          .append(' ');
    }

    sb.append(Util.makeTwo(localDate[TIME_HOUR]))
        .append(':')
        .append(Util.makeTwo(localDate[TIME_MINUTE]));

    return sb.toString();
  }
Exemple #3
0
 public static String getDate(String format, long anyDate) {
   if (0 == anyDate) return "error";
   int[] localDate = createDate(anyDate);
   format = Util.replace(format, "%H", Util.makeTwo(localDate[TIME_HOUR]));
   format = Util.replace(format, "%M", Util.makeTwo(localDate[TIME_MINUTE]));
   format = Util.replace(format, "%S", Util.makeTwo(localDate[TIME_SECOND]));
   format = Util.replace(format, "%Y", "" + localDate[TIME_YEAR]);
   format = Util.replace(format, "%y", Util.makeTwo(localDate[TIME_YEAR] % 100));
   format = Util.replace(format, "%m", Util.makeTwo(localDate[TIME_MON]));
   format = Util.replace(format, "%d", Util.makeTwo(localDate[TIME_DAY]));
   return format;
 }