Intro
This examples will show how to convert a date into milliseconds. To convert a date into miliseconds, you can use the getTime() method of the java.util.Date class.
Examples
package com.freesamplecode.java.datetime; import java.util.Date; public class ConvertDateMillisecodDemo { public static void main(String[] args){ Date date = new Date(); System.out.println("Current Date is : "+date); System.out.println("Current Date in millisecond : "+date.getTime()); } }
Output
Current Date is : Sun Mar 13 06:49:57 ICT 2016 Current Date in millisecond : 1457826597127
0 comments: