Date and Time Functions: NOW, TODAY, YEAR, MONTH, DAY, HOUR, MINUTE, SECOND
In this blog post, we will learn about some common date and time functions in Excel and how to use them. These functions can help us manipulate and extract information from dates and times in our worksheets.
NOW: This function returns the current date and time as a serial number. The syntax is =NOW(). For example, if we enter =NOW() in cell A1 on March 21st 2023 at 4:50 PM GMT+00:00, we will get 44541.20139 as the result.
TODAY: This function returns the current date as a serial number. The syntax is =TODAY(). For example, if we enter =TODAY() in cell A2 on March 21st 2023 at any time of the day, we will get 44541 as the result.
YEAR: This function returns the year of a given date as a four-digit number. The syntax is =YEAR(date). For example, if we enter =YEAR(A1) in cell A3 using the previous example of NOW function, we will get 2023 as the result.
MONTH: This function returns the month of a given date as a number from 1 to 12. The syntax is =MONTH(date). For example, if we enter =MONTH(A1) in cell A4 using the previous example of NOW function, we will get 3 as the result.
DAY: This function returns the day of a given date as a number from 1 to 31. The syntax is =DAY(date). For example, if we enter =DAY(A1) in cell A5 using the previous example of NOW function, we will get 21 as the result.
HOUR: This function returns the hour of a given time as a number from 0 to 23. The syntax is =HOUR(time). For example, if we enter =HOUR(A1) in cell A6 using the previous example of NOW function, we will get 16 as the result.
MINUTE: This function returns the minute of a given time as a number from 0 to 59. The syntax is =MINUTE(time). For example, if we enter =MINUTE(A1) in cell A7 using the previous example of NOW function, we will get 50 as the result.
SECOND: This function returns the second of a given time as a number from 0 to 59. The syntax is =SECOND(time). For example, if we enter =SECOND(A1) in cell A8 using the previous example of NOW function, we will get 56 as the result.
Conclusion:
We have learned how to use some common date and time functions in Excel and how they can help us manipulate and extract information from dates and times in our worksheets. We can also combine these functions with other formulas or functions to perform more complex calculations or operations with dates and times.
FAQs:
Q: How can I format the results of these functions to show them as dates or times?
A: You can use the Format Cells dialog box (Ctrl+1) or the Number group on the Home tab to apply different formats for dates or times. For example, you can choose Short Date or Long Date for dates, and Time or Custom for times.
Q: How can I calculate the difference between two dates or times?
A: You can simply subtract one date or time from another to get their difference. For example, if you want to calculate how many days are left until your birthday on April 15th, you can enter =TODAY()-DATE(2023,4,15) in any cell and format it as General. You will get -25 as the result, which means there are still 25 days until your birthday.
Previous Chapter
Next Chapter