Java Timestamp Create getTimestamp(Date date)

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

Description

get Timestamp

License

Apache License

Return

Returns the given date in a 'yyyy.MM.dd.HH.mm.ss' format, UTC timezone

Declaration

public static String getTimestamp(Date date) 

Method Source Code

//package com.java2s;
/*//www  .j a v  a 2 s.c o  m
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

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

import java.util.TimeZone;

public class Main {
    /** @return Returns the given date in a 'yyyy.MM.dd.HH.mm.ss' format, UTC timezone */
    public static String getTimestamp(Date date) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        return dateFormat.format(date);
    }
}

Related

  1. getTimestamp(Calendar time)
  2. getTimeStamp(Date date)
  3. getTimeStamp(Date date)
  4. getTimeStamp(Date date)
  5. getTimeStamp(Date date)
  6. getTimestamp(Date date, String timestampPattern)
  7. getTimestamp(Date time)
  8. getTimestamp(final File file)
  9. getTimestamp(final LocalDate date)