Sample Get Current Date and Time to String

Posted on July 7, 2011
import java.util.Date;
import android.text.format.DateFormat;

 

String currentTime = (String) DateFormat.format("yyyy-MM-dd hh:mm:ss", new Date());

Categories: Android Code Snippets


Leave a Reply

Switch to our desktop site