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

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -