In Java, Can the Date type just hold MM-dd-yyyy or just hh:mm:ss? -


i converting epoch format time normal format, when convert date get, mm-dd-yyyy hh:mm:ss.

if want single out date or time have use simpledateformat. returns string. wondering if there way make string date type.

the type java.util.date timestamp, not more wrapper number of milliseconds since 01-01-1970, 00:00:00 utc. (the class name date unfortunately badly chosen).

it not suited holding date or time value.

if using java 8, use new date , time api (package java.time); use example localdate if need store year/month/day, or localtime if need store time-of-day (hours, minutes, seconds, milliseconds).

if using java 7 or older, consider using equivalent classes in joda time library.


Comments

Popular posts from this blog

testing - Detect whether test has failed within fixture -

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

android - Create single AAR file from multiple modules using Gradle -