This Excel tutorial explores date formatting, covering default and custom formats, locale conversion, and troubleshooting. Dates and times are fundamental in Excel, yet their varied display and consistent internal storage can be confusing. Understanding this internal representation saves significant time.
This first part focuses on:
- Excel's date storage mechanism
- Converting dates to numbers
- Default date and time formats
- Changing date formats
- Converting date formats to different locales
- Creating custom date and time formats
- Troubleshooting date formatting issues
Excel's Date and Time Storage
Excel stores dates as sequential integers representing days since January 1, 1900 (1 = January 1, 1900, 2958465 = December 31, 9999). Times are stored as decimals (0.0 = 00:00:00, 0.99999 = 23:59:59), representing a fraction of a day. Combined date and time values are decimal numbers with the integer portion representing the date and the decimal portion representing the time.
Converting Dates to Numbers
To view the serial number representing a date:
- Format Cells: Select the cell, press Ctrl 1, choose "General," note the number shown, and click "Cancel" (or "OK" to permanently change the cell's value).
-
DATEVALUE
andTIMEVALUE
functions: Use=DATEVALUE("mm/dd/yyyy")
for the date's serial number and=TIMEVALUE("hh:mm AM/PM")
for the time's decimal. Combine them with&
for both date and time. Note that dates before 1900 are not supported.
Default Date Formats
Excel's short and long date formats are determined by your Windows Regional settings. These are marked with an asterisk (*) in the "Format Cells" dialog.
Changing Default Date and Time Formats
To change the defaults:
- Go to Control Panel > Region and Language (or Clock, Language, and Region > Region and Language > Change date, time, or number format).
- On the "Formats" tab, select your region and modify the date and time formats.
- For more customization, click "Additional settings" and adjust the short and long date formats.
Quickly Applying Default Formatting
To quickly apply default date/time formatting:
- Select the cells.
- On the "Home" tab, in the "Number" group, click the arrow next to "Number Format" and choose the desired format (short date, long date, or time). Alternatively, select "More Number Formats" for additional options. Ctrl Shift # applies the
dd-mmm-yy
format.
Changing Date Formats
To change a cell's date format:
- Select the cells.
- Press Ctrl 1 ("Format Cells").
- Choose "Date" in the "Category" list and select the desired format.
Converting Date Formats to Different Locales
To change the date format based on a different locale:
- Select the cells.
- Press Ctrl 1 ("Format Cells").
- Select the desired locale under "Locale (location)".
Creating Custom Date Formats
To create a custom format:
- Select cells.
- Press Ctrl 1 ("Format Cells").
- Choose "Custom" and enter your format code using codes like
m
,mm
,mmm
,mmmm
,d
,dd
,yy
,yyyy
,h
,hh
,m
,mm
,s
,ss
,AM/PM
.
Creating Custom Formats for Different Locales
To display dates in another language, use a locale code within square brackets, preceded by $
, e.g., [$-409]
(English, US).
Troubleshooting
-
#####
error: Cells are too narrow; widen the column. -
Negative numbers as dates: Switch to the 1904 date system or use the
TEXT
function (returns text, not a number). -
Dates imported as text: Use
DATEVALUE
or "Text to Columns" to convert.
This concludes the first part. The next part will cover inserting dates and times.
(Note: The image URLs are assumed to be valid and are included as requested. I cannot display the images directly.)
The above is the detailed content of How to change Excel date format and create custom formatting. For more information, please follow other related articles on the PHP Chinese website!

Excel wildcards: a powerful tool for efficient search and filtering This article will dive into the power of wildcards in Microsoft Excel, including their application in search, formulas, and filters, and some details to note. Wildcards allow you to perform fuzzy matching, making it more flexible to find and process data. *Wildcards: asterisks () and question marks (?)** Excel mainly uses two wildcards: asterisk (*) and question mark (?). *Asterisk (): Any number of characters** The asterisk represents any number of characters, including zero characters. For example: *OK* Match the cell containing "OK", "OK&q

The tutorial shows how to create multiple IF statements in Excel with AND as well as OR logic. Also, you will learn how to use IF together with other Excel functions. In the first part of our Excel IF tutorial, we looked at how to constru

In this tutorial, you will lean a quick way to calculate percentages in Excel, find the basic percentage formula and a few more formulas for calculating percentage increase, percent of total and more. Calculating percentage is useful in m

Logical operators in Excel: The key to efficient data analysis In Excel, many tasks involve comparing data in different cells. To this end, Microsoft Excel provides six logical operators, also known as comparison operators. This tutorial is designed to help you understand the connotation of Excel logical operators and write the most efficient formulas for data analysis. Excel logical operators equal Not equal to Greater than/less than/greater than/six equal to/less than equal to Common uses of logical operators in Excel Overview of Excel Logical Operators Logical operators in Excel are used to compare two values. Logical operators are sometimes called boolean operators because in any given case, the result of comparison

This concise guide explores Excel's percentage formatting capabilities, covering various scenarios and advanced techniques. Learn how to format existing values, handle empty cells, and customize your percentage display. To quickly apply percentage f

The tutorial explains the essence of Excel logical functions AND, OR, XOR and NOT and provides formula examples that demonstrate their common and inventive uses. Last week we tapped into the insight of Excel logical operators that are us

This guide explores Microsoft Excel's comment and note features, explaining their uses and differences. Both tools annotate cells, but serve distinct purposes and display differently in printed worksheets. Excel Comments: Collaborative Annotations E

Excel template: a tool for efficient office work Microsoft Excel templates are a powerful tool to improve the efficiency of Excel, saving significantly time. After creating a template, you only need a small amount of adjustment to adapt to different scenarios and achieve reuse. Well-designed Excel templates can also improve the aesthetics and consistency of documents, leaving a good impression on colleagues and bosses. The value of templates is particularly prominent for common document types such as calendars, budget planners, invoices, inventory tables, and dashboards. What else is more convenient than just using a spreadsheet that looks beautiful, has a full-featured and is easy to customize? A Microsoft Excel template is a pre-designed workbook or worksheet, most of which


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

WebStorm Mac version
Useful JavaScript development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Notepad++7.3.1
Easy-to-use and free code editor
