Java Time Now printTime(Date date)

Here you can find the source of printTime(Date date)

Description

print Time

License

Apache License

Declaration

public static String printTime(Date date) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.DateFormat;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static String printTime(Date date) {
        if (date == null)
            return null;
        DateFormat formatter = new SimpleDateFormat("HH:mm:ss");
        DateFormat tzFormatter = new SimpleDateFormat("Z");
        String timezone = tzFormatter.format(date);
        return formatter.format(date) + timezone.substring(0, 3) + ":" + timezone.substring(3);
    }//  ww  w. j av  a 2s. c  om
}

Related

  1. getTimeString()
  2. getTimeString()
  3. getTimeString()
  4. printTime()
  5. printTime()
  6. readCurrentTime()