πŸ“Š JAVA
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();
πŸ’¬ Discuss
βœ… Correct Answer: (B) SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); sdf.format(new Date());

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
137
Total Visits
πŸ“½οΈ
12 mo ago
Published
πŸŽ–οΈ
Kiran Rapria
Publisher
πŸ“ˆ
82%
Success Rate