Java Timestamp Now getTimeStamp()

Here you can find the source of getTimeStamp()

Description

get Time Stamp

License

Apache License

Declaration

public static String getTimeStamp() 

Method Source Code

//package com.java2s;
/**//from   www  . j av  a 2s  .c  om
 * Copyright 2012 David L. Whitehurst
 * 
 * Licensed 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.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    public static String getTimeStamp() {
        Timestamp timestamp = new Timestamp(System.currentTimeMillis());
        Date date = new Date(timestamp.getTime());

        // S is the millisecond
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy' 'HH:MM:ss:S");

        return simpleDateFormat.format(timestamp);
        //System.out.println(simpleDateFormat.format(timestamp));
        //System.out.println(simpleDateFormat.format(date));
    }
}

Related

  1. getTimestamp()
  2. getTimestamp()
  3. getTimestamp()
  4. getTimestamp()
  5. getTimestamp()
  6. getTimeStamp()
  7. getTimestamp()
  8. getTimestamp()
  9. getTimeStamp()