Current timestamp: 1503079206

Countdown to: 1503100000

Convert timestamp

Convert date

Java Quick Examples

Following page provides examples for Java how to convert date, time, and timestamp among each other. There are also some links to additional documentation, so you can learn more about the topic.

How To Get Current Timestamp in Java

long ts = System.currentTimeMillis()/1000;

How To Convert Timestamp to Date in Java

import Java.Util.Date;
import java.text.SimpleDateFormat;
Date currentDate = new Date (1.503079206E+12)
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss")
String date = dateFormat.format(currentDate);

How To Convert Date to Timestamp in Java

import java.text.SimpleDateFormat;
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss")
long ts = dateFormat.parse(2017-08-18 20::00:06).getTime()/1000;

Great example for Java!!!
This website uses cookies to ensure you get the best experience on our website. More info