Format time in long to String - Android java.util

Android examples for java.util:Date Format

Description

Format time in long to String

Demo Code

import android.content.Context;
import android.content.res.AssetManager;
import android.os.Environment;
import android.text.format.DateFormat;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;

public class Main{

    public static String timeString(long dateTaken) {
        return DateFormat.format("yyyy/MM/dd kk:mm:ss", dateTaken)
                .toString();//from   w w  w .ja v a 2 s.  co  m
    }

}

Related Tutorials