跳到主要内容

如何在Excel中将日期转换为数字字符串或文本格式?

在本教程中,我将介绍几种解决有关在Excel中将日期转换为数字或文本格式的不同情况的方法。
doc日期至数字文字1


1.将日期转换为文本

本节提供了在Excel中将日期转换为文本的方法。

要将日期转换为文本,您只需要一个公式。

公式:= TEXT(date,“ date_format”)

文献参考: 日期:您要转换为文本的日期单元格
日期格式: 将日期转换为文本后要显示的格式

在以下情况下,我将告诉您如何使用此公式。

1.1将日期转换为mm / dd / yyyy格式的文本

例如,将单元格A3中的日期转换为mm / dd / yyyy,使用公式
= TEXT(A3,“ mm / dd / yyyy”)
express 输入
doc日期至数字文字2

如果要将单元格A8中的日期转换为dd / mm / yyyy,请使用以下公式
= TEXT(A8,“ dd / mm / yyyy”)
express 输入
doc日期至数字文字3

1.2将日期转换为mmddyyyy或ddmmyyyyy格式的文本

如果要将单元格A13中的日期转换为文本,但格式为mmddyyyy,请键入以下公式
= TEXT(A13,“ mmddyyyy”)
express 输入
doc日期至数字文字4

如果要将单元格A18中的日期转换为ddmmyyyy格式的文本,请键入以下公式
= TEXT(A18,“ ddmmyyyy”)
express 输入
doc日期至数字文字5

1.3将日期转换为其他格式的文本

实际上,无论您要将日期转换为哪种文本格式,都只需在公式中的引号之间键入所需的格式。

日期(A3) 12/23/2019
公式 = TEXT(A3,“ mm-dd-yyyy”) = TEXT(A3,“ mm / dd”) = TEXT(A3,“ dd”) = TEXT(A3,“ d / m / y”)
结果 23-12-2019 23/12 23 23/12/19

新品种!
约会工具

16种新的日期功能为您解决了90%的Excel中日期处理任务。

◆加上或减去迄今的年/月/日/周, 点击查看更多细节.

◆加上或减去秒/分钟/小时 点击更多.

◆计算两个日期之间的周末/工作日。 点击更多.

◆从日期中删除时间。 点击查看更多细节.

◆将时间转换为十进制秒/分/小时。 点击查看更多细节.

◆将多种日期格式转换为美国标准日期格式。 点击查看更多细节.

30 天免费试用完整功能,30天无理由退款。


2.将日期转换为数字

在本节中,我提供了将日期转换为mmddyyyy格式的5位数字的方法。

2.1将日期转换为5位数字的数字

如果要将日期转换为5位数格式的数字,请按照以下步骤操作:

1.右键单击包含要转换为数字的日期的单元格,然后在右键菜单中选择 单元格格式 常见。
doc日期至数字文字6

2。 在 单元格格式 对话下 联系电话 标签,选择 总类 从的窗格 产品分类.
doc日期至数字文字7

3。 点击 OK。 所选单元格中的日期已转换为mmddyyyy格式的数字字符串。
doc日期至数字文字8

2.2将日期转换为mmddyyyy或ddmmyyyyy格式的数字

如果要将日期转换为mmddyyyy或ddmmyyyyy格式的数字字符串,还可以应用“设置单元格格式”功能。

1.右键单击包含要转换为数字的日期的单元格,然后在右键菜单中选择 单元格格式 常见。

2.在 单元格格式 对话框下 联系电话 标签,选择 定制版 来自 产品分类 窗格,然后转到右侧部分,输入 MMDDYYYYType 文本框。
doc日期至数字文字9

3。 点击 OK。 所选单元格中的日期已转换为mmddyyyy格式的数字字符串
doc日期至数字文字10

如果要将日期转换为其他格式的数字字符串,可以参考以下列表。

日期 2/23/2019
将单元格设置为自定义格式 天啊 天啊 y 年年月日
显示器 23022019 230219 022019 20190223

3.单击将日期转换为月/日/年或其他日期格式

如果您想将日期快速转换为月,日,年或其他日期格式,则 套用日期格式 实用程序 Kutools for Excel 将是一个很好的选择。

跟老鼠手和颈椎病说再见

Kutools for Excel 的 300 个高级工具解决 80% 数秒内完成 Excel 任务,让您摆脱数千次鼠标点击。

轻松处理1500个工作场景,无需浪费时间来寻找解决方案,而有很多时间来享受生活。

包括您在内,每天为80多名高效人员提高110000%的生产力。

不再受痛苦的配方和VBA的折磨,让您的大脑得到休息和愉悦的工作氛围。

30 天免费试用全功能,30 天无理由退款。

更好的身体创造更好的生活。

免费安装 Kutools for Excel,请执行以下操作:

1.选择包含要转换为其他日期格式的日期的单元格。

2。 点击 库工具 > 格式 > 套用日期格式.
doc日期至数字文字11

3.在 套用日期格式 对话框中,选择要在其中使用的日期格式 日期格式 窗格,与此同时,转换后的结果将在右侧预览 预览 窗格。
doc日期至数字文字12

4。 点击 Ok,则您选择的日期已转换为您选择的日期格式。
doc日期至数字文字13

点击即可将日期转换为多种个性化日期格式

应用日期格式

有关日期转换的更多提示


下载样本文件

样品


推荐的生产力工具

Office 选项卡 - Microsoft Office 2019 - 2003 和 Office 365 中文档的选项卡式浏览、编辑、管理


办公室选项卡

Kutools for Excel - 结合了 300 多个 Microsoft Excel 的高级功能和工具


kutools选项卡
kutoolsp选项卡
Comments (40)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi, I would very much appreciate your help with this formula.How can I switch month, date ,year “030624”in to a number 306042 and put the number in sequential order after the number 306042 like: 3060421
This comment was minimized by the moderator on the site
Hi, I would very much appreciate your help with this formula.How can I switch month, date ,year “030624”in to a number 306042 and put the number in sequential order after the number 306042 like: 3060421
This comment was minimized by the moderator on the site
Hello, how i convert 13.09.2023 to 13.9 my numbers change into dates
This comment was minimized by the moderator on the site
I want to know how many times I went to check the inspection. which I recorded by days.
This comment was minimized by the moderator on the site
Hello. I would very much appreciate your help with this formula. I am wishing to enter the customer's date of birth in cell I3 (custom formatting mm/dd/yy) and would like that date of birth to automatically populate in A3 cell as mmddyy along with adding the First letter from First name cell F3 and First letter from Last name cell G3 in order to have it auto-populate an ID# for our customers in our database.

A3 F3 G3 I3
ID# First Name Last Name Date of Birth
030199AS Adam Smith 03/01/1999

Thank you so much for any help. You have no idea how much I appreciate it. I have been wracking my brain all night to no avail. :(
Shena Bruno
This comment was minimized by the moderator on the site
Hi, Shena, Bruno, in A3, please use the formula =TEXT(I3, mmddyyyy")&LEFT(F3,1)&LEFT(G3,1).
In the formula, it can be explained as two parts:
TEXT(I3, mmddyyyy") will change the value in I3 to this format mmddyyyy
LEFT(F3,1)&LEFT(G3,1) will extract the first character from left side of the strings in cell F3 and G3.
Hope it is helpful.
This comment was minimized by the moderator on the site
I want to convert the day (Tuesday) which is showing up as 1/3/1900 when you click on it because I added a formula on the original data to provide me with Day values. Now I want to use a pivot table to show me the actual days. How do I convert the 1/3/1900 which shows up at Tuesday to just Tuesday? 
This comment was minimized by the moderator on the site
Hi, Cathey, do you want to convert the formula to an actual value? If so, you can use the Paste as Value Only feature in Excel to copy and paste the formulas as values only, or you can use Kutools for Excel's To Actual feature to convert formulas to values.
This comment was minimized by the moderator on the site
Hi, I was trying to copy and past the value but its still showing the date as opposed to the day. 
This comment was minimized by the moderator on the site
Hi, Cathey, do you choose the Paste as Value option in right-click context menu? If you have choosed, try to press Ctrl +1 keys to enable format cells feature and change the cell format to mm/dd/yyyy in Date section.
This comment was minimized by the moderator on the site
Hello. I have the date 26.01.2021 in the cell A1 and in another cell I have the formula: =RIGHT(A1,4) to take the year from that date, and it returns “4526” instead of “2021”. Do you know how to solve it? Thank you very much!
This comment was minimized by the moderator on the site
try to change the format on cell A1 to general or number and then enter the values that you want again to see if it helps. I think your problem is the format issue.
This comment was minimized by the moderator on the site
Hi, I want to convert month to number. For exp: 8 months (date format) ---> "8" as a number or value. I've change its format but I can't count it.Because I want to put it to math format, for exp: 8-2 = 6 (8 from the months). But the 8 doesn't work.Hope you get it. Thank you for helping!
This comment was minimized by the moderator on the site
Hi i have a date in "13/02/2020 11:42:09" format and i want in MM/DD/YYYY format
This comment was minimized by the moderator on the site
Hi, just select the cell then apply the Text to Columns, in the Text to Columns, choose Delimiter > Space > Date(in the Date format, choose DMY) > Finish.
This comment was minimized by the moderator on the site
There is another way, it returns exactly the numeric format that represents the date abbreviated by (/), it would be: '=Substitute(A1;"/";"")
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations