XL: Displaying the Current Date and Time with Text

ID: Q95951


The information in this article applies to:


SUMMARY

You can enter the current date and/or time as text by using the TEXT function with the TODAY or NOW functions. For example, to display "Today is 2/18/98" (without the quotations marks), where 2/18/98 is the current date, use the following formula:


   ="Today is "&TEXT(TODAY(),"m/d/yy") 


NOTE: You can substitute the NOW function for the TODAY function in the above formula to display the date and time or just the time (depending on the number format you specify).

You can also display "Today is 2/18/98" (without the quotation marks), and preserve the value of the date as a serial number rather than converting it to text.

To display the current time, use the following formula:


    =NOW()-TODAY() 


This formula will update each time the sheet is calculated.


MORE INFORMATION

The TEXT() function converts a value to text in a specified number format.

To display the following


   The current date and time is 2/18/93 5:57 PM 


use this formula:


   ="The current date and time is "&TEXT(NOW(),"m/d/yy h:mm AM/PM") 


To display the following


   The current time is 5:57 PM 


use this formula:


   ="The current time is "&TEXT(NOW(),"h:mm AM/PM") 


If you want a linked formula in a chart to display this information but you do not want to open the file, use the TEXT() function (as discussed above).

To display the time but preserve the value as a serial number, follow these steps:

  1. Select the cell you want to format.


  2. On the Format menu, click Number. (Or, click Cells on the Format menu, and then click the Number tab.) In the Category list, click Date or Custom.


  3. In the Code or Type entry box, type "Today is " (including the quotation marks and one space after "is") immediately followed by the date format you want to use (for example, m/d/yy, or d/mmm/yy), and then click OK.


  4. In the formatted cell, type =TODAY().


The cell will display "Today is m/d/yy" (where m/d/yy is the current date and is displayed in the format you selected in step 3). The value of the date is stored as a serial number.


REFERENCES

"Microsoft Excel Function Reference," version 4.0, page 431-432
"Microsoft Excel Function Reference," version 3.0, page 234-235

Additional query words: XL98 XL97 XL7 XL5 XL4 XL3 5.00 concatenate


Keywords          : kbdta xlformula 
Version           : WINDOWS:2.0,3.0,4.0,4.0a,5.0,7.0,97; MACINTOSH:2.0,3.0,4.0,5.0,98; os/2:2.2,3.0
Platform          : MACINTOSH OS/2 WINDOWS 
Issue type        : kbhowto kbinfo 

Last Reviewed: March 31, 1999