Here you can find the source of getTimestamp(Context context)
Parameter | Description |
---|---|
context | Application Context |
@SuppressWarnings("UnnecessaryFullyQualifiedName") public static String getTimestamp(Context context)
//package com.java2s; import android.content.Context; import java.util.Date; public class Main { /**/* ww w .j av a 2s. c o m*/ * Return a timestamp * * @param context Application Context */ @SuppressWarnings("UnnecessaryFullyQualifiedName") public static String getTimestamp(Context context) { String timestamp = "unknown"; Date now = new Date(); java.text.DateFormat dateFormat = android.text.format.DateFormat .getDateFormat(context); java.text.DateFormat timeFormat = android.text.format.DateFormat .getTimeFormat(context); if (dateFormat != null && timeFormat != null) { timestamp = dateFormat.format(now) + ' ' + timeFormat.format(now); } return timestamp; } }