Android Context Get getTimestamp(Context context)

Here you can find the source of getTimestamp(Context context)

Description

Return a timestamp

Parameter

Parameter Description
context Application Context

Declaration

@SuppressWarnings("UnnecessaryFullyQualifiedName")
public static String getTimestamp(Context context) 

Method Source Code

//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;
    }
}

Related

  1. getSystemDiskCacheDir(Context context)
  2. getTCBoldFont(Context context)
  3. getTCFont(Context context)
  4. getTCItalicFont(Context context)
  5. getTempFile(Context context)
  6. getTypeface(Context context, String name)
  7. getUserAgentString(Context context)
  8. getVersion(Context context)
  9. getVersionCode(Context mContext)