If your real goal is to serialize a Date
object for some kind of custom made persistence or data transfer, a simple solution would be:
Date d = new Date();
long l = d.getTime();
Date theSameDate = new Date(l);
Related Contents:
- Can I define `default constructor` in Java?
- on clicking the picture it should get stored in the internal storage of my mobile
- Why is a ConcurrentModificationException thrown and how to debug it
- Selenium – Basic Authentication via url
- SQlite Getting nearest locations (with latitude and longitude)
- Why am I not getting a java.util.ConcurrentModificationException in this example?
- Why would you ever implement finalize()?
- How to avoid java.util.ConcurrentModificationException when iterating through and removing elements from an ArrayList
- How to specify the default error page in web.xml?
- Getting request payload from POST request in Java servlet
- Why does the behavior of the Integer constant pool change at 127?
- Java: Ternary with no return. (For method calling)
- Closing JDBC Connections in Pool
- Quickest way to find missing number in an array of numbers
- How should equals and hashcode be implemented when using JPA and Hibernate
- I want to get Year, Month, Day, etc from Java Date to compare with Gregorian Calendar date in Java. Is this possible?
- POSTing a @OneToMany sub-resource association in Spring Data REST
- Parse Web Site HTML with JAVA [duplicate]
- Why I can’t create an array with large size?
- How to sum digits of an integer in java?
- How to simulate keyboard presses in java?
- Java Array HashCode implementation
- Why is it not a good practice to synchronize on Boolean?
- Merging two images
- Why is an anonymous inner class containing nothing generated from this code?
- How to select and crop an image in android?
- Custom ObjectMapper with Jersey 2.2 and Jackson 2.1
- Session is lost and created as new in every servlet request
- Changing the shapes of points in scatter plot
- Java Animate JLabel
- JTable how prepareEditor works
- How to decompile DEX into Java source code?
- Can I scroll a ScrollView programmatically in Android?
- Comparing boxed Long values 127 and 128
- Can I add JRadioButton into JTable
- The activity must be exported or contain an intent-filter
- Convert String XML fragment to Document Node in Java
- How to fetch Android Market data when there is no API?
- JPA Criteria API – How to add JOIN clause (as general sentence as possible)
- Java Generic Class – Determine Type
- No results returned by the Query error in PostgreSQL
- Driver executable must be set by the webdriver.ie.driver system property
- Inserting code with XJC+xsd+jxb using the options ” -Xinject-code -extension “
- How can I show/hide component with JSF?
- Open a text file in the default text editor… via Java?
- play .wav file from jar as resource using java
- Refactoring if/else logic
- Java casting in interfaces
- Get full URL and query string in Servlet for both HTTP and HTTPS requests
- In Java, how do I access the outer class when I’m not in the inner class?