Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Date(Long) to integer and back

    int i = (int) (new Date().getTime()/1000);
    System.out.println("Integer : " + i);
    System.out.println("Long : "+ new Date().getTime());
    System.out.println("Long date : " + new Date(new Date().getTime()));
    System.out.println("Int Date : " + new Date(((long)i)*1000L));

Integer : 1345619256
Long : 1345619256308
Long date : Wed Aug 22 16:37:36 CST 2012
Int Date : Wed Aug 22 16:37:36 CST 2012
Comment

PREVIOUS NEXT
Code Example
Java :: java command to start jenkins 
Java :: BottomNavigationView only icon 
Java :: The this(Keyword) 
Java :: Cannot find a class with the main method. 
Java :: spring-boot java header appliacation/json constant 
Java :: spring log info 
Java :: check if field exists in java 
Java :: java create file 
Java :: elif java 
Java :: check if a char is a space java 
Java :: get index of element in array java 
Java :: thread java timer 
Java :: java array sorting java8 
Java :: if else statement 
Java :: java sort a map by keys 
Java :: how to empty list in java 
Java :: what are abstract methods in java 
Java :: create hashmap in java 
Java :: java map keyset to list 
Java :: simple for loop 
Java :: new keyword in java 
Java :: Java List Add Elements using add() method 
Java :: select list of values from db java 
Java :: array of arrays java 
Java :: lcm of two large positive integers java 
Java :: Calendar ranges java 
Java :: Stop gninnipS My sdroW! javascrip codewars 
Java :: default case in Java switch-case 
Java :: what is use of drivermanager class 
Java :: how to know if a file is iso-8859-1 encoded in java 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =