Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a simple React component that shows the current date using JavaScript's Date object.

Easy

Problem Statement

Write a simple React component that shows the current date using JavaScript's Date object.

Sample Output

Today's date is: YYYY-MM-DD (e.g., Today's date is: 2024-11-12)

Limits

Time: 2s · Memory: 256 MB

Code Editor

Try your code in this preview. Submit marks it done.

import React from "react";
 
 const CurrentDate = () => {
  const today = new Date();
  // Format the date using today.getFullYear(), today.getMonth(), and today.getDate()
 
  return (
  // Return a JSX element displaying the formatted date
  );
 };
 
 export default CurrentDate;