Get Tomorrow’s Date in String Format in JavaScript

Last Updated : 31 Aug, 2026

JavaScript’s Date object can be used to calculate tomorrow’s date and format it as a string. By adding one day to the current or given date, the result can be formatted as YYYY-MM-DD.

  • Use setDate() and getDate() to move the date forward by one day.
  • Use getFullYear(), getMonth(), and getDate() to extract the date components.
  • Use padStart() and template literals to create the final string format.

Approach: Using Date Object and String Formatting

The Date object is used to create the date, while setDate() increases it by one day. The date components are then formatted with leading zeros where required.

Example 1:

JavaScript
<script>
    const tomorrow = () => {
    
        // Creating the date instance
        let d = new Date();
    
        // Adding one date to the present date
        d.setDate(d.getDate() + 1);
    
        let year = d.getFullYear()
        let month = String(d.getMonth() + 1)
        let day = String(d.getDate())
    
        // Adding leading 0 if the day or month
        // is one digit value
        month = month.length == 1 ? 
            month.padStart('2', '0') : month;
    
        day = day.length == 1 ? 
            day.padStart('2', '0') : day;
    
        // Printing the present date
        console.log(`${year}-${month}-${day}`);
    }
    
    tomorrow()
</script>

Example 2: Using a Given Date

The same approach can be used with a specific date by passing it as an argument to the function.

JavaScript
<script>
    const tomorrow = (dt) => {
    
        // Creating the date instance
        let d = new Date(dt);
    
        // Adding one date to the present date
        d.setDate(d.getDate() + 1);
    
        let year = d.getFullYear()
        let month = String(d.getMonth() + 1)
        let day = String(d.getDate())
    
        // Adding leading 0 if the day or month
        // is one digit value
        month = month.length == 1 ? 
            month.padStart('2', '0') : month;
    
        day = day.length == 1 ? 
            day.padStart('2', '0') : day;
    
        // Printing the present date
        console.log(`${year}-${month}-${day}`);
    }
    
    tomorrow("2020-12-31")
    tomorrow("2021-02-28")
    tomorrow("2021-4-30")
</script>

Note: Enter the date in yyyy-mm-dd format.

Comment