Android Timestamp Create getCurrentTimestamp()

Here you can find the source of getCurrentTimestamp()

Description

Get current time include time zone to save to DB

License

Open Source License

Return

time string

Declaration

@SuppressLint("SimpleDateFormat")
public static String getCurrentTimestamp() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;
import java.util.Calendar;
import android.annotation.SuppressLint;

public class Main {
    /**//from   www .  j a va  2  s. c  om
     * Get current time include time zone to save to DB
     * 
     * @return time string
     */
    @SuppressLint("SimpleDateFormat")
    public static String getCurrentTimestamp() {
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar
                .getInstance().getTime());
    }
}

Related

  1. getTimestamp()
  2. getCurrentTimestamp()