get Timestamp string in yyyy-MM-dd'T'HH:mm:ss format - Android java.text

Android examples for java.text:SimpleDateFormat

Description

get Timestamp string in yyyy-MM-dd'T'HH:mm:ss format

Demo Code

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class Main{

    public static String getTimestamp() {

        // ISO-8601 combined date and time format
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
        return sdf.format(new Date());

    }//from  www.  ja  v a  2  s.co  m

}

Related Tutorials