datetime - How to get Timestamp with AM/PM in java -
i have date string , needs converted in time stamp am/pm . tried below way, i'm getting proper date format didn't in am/pm.
can 1 please ?
code snippet:
string datestring = "10/10/2010 11:23:29 am"; simpledateformat sfdate = new simpledateformat("mm/dd/yyy hh:mm:ss a"); date date = new date(); date = sfdate.parse(datestring); system.out.println(new timestamp(date.gettime()));
which gives me output below :
2010-10-10 11:23:29.0
but needs
2010-10-10 11:23:29.00000000
kindly me please.
why create timestamp ? when can :
simpledateformat sfdate = new simpledateformat("mm/dd/yyy hh:mm:ss a"); date date = new date(); date = sfdate.parse(datestring); system.out.println(sfdate.format(date) );
output:
10/10/10 11:23:29
Comments
Post a Comment