A Admin • 828.43K Points Coach Q. How to convert Date object to String? (A) SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); sdf.parse(new Date()); (B) SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); sdf.format(new Date()); (C) SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); new Date().parse(); (D) SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); new Date().format(); Correct Answer - Option(B) Views: 16 Filed under category Java Hashtags: Share Manage Tags
Discusssion
Login to discuss.