Java Convert String to Date -
i have database date field return
resultset.getdate("startdate"); i change format of dd-mmm-yy , preserve date type means wouldn't convert string.
i have following code snippet change date format
private date getdate(resultset resultset,date columnname) simpledateformat format1 = new simpledateformat("dd-mmm-yy"); string date = new simpledateformat("dd-mmm-yy").format(columnname); what best approach convert string again date same date format
dd-mmm-yy
i change format of dd-mmm-yy , preserve date type means wouldn't convert string.
that not possible; have misunderstanding date object represents.
a date object contains timestamp value, , not know how should formatted when printed. so, cannot have date object format.
instead, set format on simpledateformat object, use convert date object text.
Comments
Post a Comment