DATEVALUE

See Also

Returns the serial number of the date represented by date_text. Use DATEVALUE to convert a date represented by text to a serial number.

Syntax

DATEVALUE(date_text)

Date_text   is text that represents a date in a date format. For example, "1/30/2008" or "30-Jan-2008" are text strings within quotation marks that represent dates.

If the year portion of date_text is omitted, DATEVALUE uses the current year from your computer's built-in clock. Time information in date_text is ignored.

Remarks

Example

The example may be easier to understand if you copy it to a blank spreadsheet.

How?

  1. Create a blank spreadsheet.
  2. Select the example in the Help topic.

    Selecting example from Help

    Selecting an example from Help

  3. Press CTRL+C.
  4. In the spreadsheet, select cell A1, and press CTRL+V.
  5. To switch between viewing the formula that returns the result and the result in the cell, select the cell and press F2 and then ENTER, or click Commands and Options on the spreadsheet toolbar, click the Formula tab, and look in the Formula in active cell (active cell) box.
Formula Description (Result)
=DATEVALUE("8/22/2008") Serial number of the text date (39682)
=DATEVALUE("22-AUG-2008") Serial number of the text date (39682)
=DATEVALUE("2008/02/23") Serial number of the text date (39501)
=DATEVALUE("5-JUL") Serial number of the text date, assuming the computer's built-in clock is set to 2000 (36712)

Note   If you want to change the display of the result from a serial number to a date format or vice versa, select the cell and click Commands and Options on the toolbar. Click the Format tab and then select the format you want in the Number Format box. To view the date as a serial number, apply the General number format.