vb更改日期时间格式_如何在Windows 10中更改日期和时间的格式

vb更改日期时间格式

vb更改日期时间格式

00_lead_image_change_date_format_windows

By default, Windows formats dates with slashes (3/23/16). However, if you want to use a different format for the date, such as using periods instead of slashes (3.23.16), that’s easy to change in Windows’ settings. You can also change the format of the time.

默认情况下,Windows格式的日期带有斜杠(3/23/16)。 但是,如果要为日期使用其他格式,例如使用句点而不是斜杠(3.23.16),则可以轻松在Windows的设置中进行更改。 您还可以更改时间格式。

The format of the date and time affects the clock on the Taskbar, as shown above. It also affects programs you run in Windows, such as Excel, unless you override the format in the program itself. For example, you might want use slashes on the date shown on the Taskbar, but use periods in the dates you enter in Excel.

如上所示,日期和时间的格式会影响任务栏上的时钟。 它还会影响您在Windows中运行的程序(例如Excel),除非您在程序本身中覆盖了格式。 例如,您可能希望在任务栏上显示的日期上使用斜杠,但在Excel中输入的日期中使用句点

We’ll show you how to select a different format and how to create a custom format for the date and time in Windows 10, 8.1, and 7. Accessing the basic choices for changing the date and time format is slightly different in each version of Windows, so we’ll discuss those procedures separately in the first three sections below. However, entering a custom format for the date and time is done the same way in all three Windows versions. So, follow the steps in one of the first three sections, depending on which version of Windows you are using, and then continue with the last section.

我们将向您展示如何在Windows 10、8.1和7中选择其他格式以及如何为日期和时间创建自定义格式。在每个版本的Windows XP中,访问更改日期和时间格式的基本选择都略有不同。 Windows,因此我们将在下面的前三个部分中分别讨论这些过程。 但是,在所有三个Windows版本中,以相同的方式输入日期和时间的自定义格式。 因此,根据所使用的Windows版本,按照前三个部分之一的步骤进行操作,然后继续最后一节。

As an example in this article, we’ll show you how to change the date format, but changing the time format is a similar process, and we’ll mention where you can do that as well.

作为本文的示例,我们将向您展示如何更改日期格式,但是更改时间格式是一个类似的过程,并且还将提及您可以在哪里进行更改。

如何在Windows 10中访问日期和时间格式设置 (How to Access the Date and Time Format Settings in Windows 10)

If you’re using Windows 10, click on the Search box or button on the Taskbar. If you don’t see the Search box or button, you can easily enable one or the other.

如果您使用的是Windows 10,请单击“搜索”框或任务栏上的按钮。 如果您没有看到“搜索”框或按钮,则可以轻松启用其中一个

Type “change the date” in the Search box. Results start to display as you type. Click “Change the date and time format” in the list of results.

在搜索框中键入“更改日期”。 输入时,结果开始显示。 在结果列表中单击“更改日期和时间格式”。

01_clicking_change_the_date_and_time_format_in_search

On this Change Date and Time Formats settings screen, you can select different formats for the “Short date”, “Long date”, “Short time”, and “Long time”.

在此更改日期和时间格式设置屏幕上,可以为“短日期”,“长日期”,“短时间”和“长时间”选择不同的格式。

02_change_date_and_time_formats_screen

You may not see the format you want in the list of options for the date or time. For example, there are various formats using slashes and a couple using dashes, but no dates using periods. You have to access a screen in the old Control Panel to be able to enter a custom date or time format.

您可能没有在日期或时间的选项列表中看到所需的格式。 例如,有多种格式使用斜线,而一对格式使用破折号,但没有日期使用句点。 您必须访问旧的控制面板中的屏幕才能输入自定义日期或时间格式。

03_selecting_a_new_short_date

To access the screen in the Control Panel that will allow you to enter a custom date or time format, click the back arrow button in the upper-left corner of the Settings screen.

要访问控制面板中允许您输入自定义日期或时间格式的屏幕,请单击“设置”屏幕左上角的后退箭头按钮。

04_clicking_back_arrow

You are returned to the Date & time screen in the Time & Language settings.

您将返回到“时间和语言”设置中的“日期和时间”屏幕。

04a_date_and_time_screen

Scroll down on the right side of the Date and time screen and click the “Additional date, time, & regional settings” link under Related settings.

在日期和时间屏幕的右侧向下滚动,然后单击“相关设置”下的“其他日期,时间和区域设置”链接。

05_clicking_additional_date_time_regional_settings

The Clock, Language, and Region screen on the Control Panel displays. In the Region section on the right, click the “Change date, time, or number formats” link. This opens the Region dialog box. See the last section of this post for information on how to create a custom date or time format from this menu.

显示“控制面板”上的“时钟,语言和区域”屏幕。 在右侧的“区域”部分中,单击“更改日期,时间或数字格式”链接。 这将打开“区域”对话框。 有关如何从此菜单创建自定义日期或时间格式的信息,请参见本文的最后一节。

Note that there are other ways of accessing the Control Panel in Windows 10 as well.

请注意, 在Windows 10中 ,还有其他访问控制面板的方法

06_clicking_change_date_time_or_number_formats

如何在Windows 8.1中访问日期和时间格式设置 (How to Access the Date and Time Format Settings in Windows 8.1)

If you’re using Windows 8.1, the procedure for changing the format of the date and time is slightly different. To begin, make sure the Start screen is active. If you’re on the desktop, click the “Start” button in the lower-left corner of the screen.

如果您使用的是Windows 8.1,则更改日期和时间格式的过程会稍有不同。 首先,请确保“开始”屏幕处于活动状态。 如果您在桌面上,请单击屏幕左下角的“开始”按钮。

07_win8_clicking_start_button

On the Start screen, start typing “change the date” (without the quotes). The Search panel opens and results start to display. When you see “Change the date and time format” appear in the list with the settings icon, click on it.

在“开始”屏幕上,开始键入“更改日期”(不带引号)。 “搜索”面板打开,结果开始显示。 当您看到“更改日期和时间格式”出现在带有设置图标的列表中时,请单击它。

08_win8_clicking_change_the_date_and_time_format

This screen allows you to select different formats for the short and long date and short and long time. However, as with Windows 10, you are limited in the available choices. If you want to use periods in your dates, you will have to enter a custom date format. We’ll show you how to access the Control Panel screen you need to do this.

该屏幕允许您为短日期和长日期以及短时间和长时间选择不同的格式。 但是,与Windows 10一样,可用选项受到限制。 如果要在日期中使用句点,则必须输入自定义日期格式。 我们将向您展示如何访问执行此操作所需的“控制面板”屏幕。

09_win8_selecting_a_short_date

To access the Control Panel, we have to go back a couple of screens. So, click the back arrow button in the upper-left corner of the Change date and tine formats screen…

要访问控制面板,我们必须返回几个屏幕。 因此,请单击“更改日期和文本格式”屏幕左上角的后退箭头按钮。

10_win8_clicking_back_arrow

…and again on the Time and language screen.

…然后在时间和语言屏幕上再次显示。

11_win8_clicking_back_arrow_time_and_language

At the bottom of the left pane on the PC Settings screen, click the “Control Panel” link. Note that there are several different ways you can access the Control Panel in Windows 8/8.1.

在“ PC设置”屏幕左窗格的底部,单击“控制面板”链接。 请注意, 可以使用几种不同的方法来访问Windows 8 / 8.1中的“控制面板”

12_win8_clicking_control_panel

On the Control Panel, click the “Change date, time, or number formats” link under Clock, Language, and Region. This opens the Region dialog box, which you will use in the last section of this article to customize the date and time format.

在控制面板上,单击“时钟”,“语言”和“区域”下的“更改日期,时间或数字格式”链接。 这将打开“区域”对话框,您将在本文的最后一部分中使用该对话框来自定义日期和时间格式。

13_win8_clicking_change_date_time_on_control_panel

如何在Windows 7中访问日期和时间格式设置 (How to Access the Date and Time Format Settings in Windows 7)

To access the date and time format settings in Windows 7, click the Start menu button and enter “change the date” (without the quotes) into the Search box. Then, click the “Change the date, time, or number format” link in the list of results. This opens the Region dialog box we discuss in the next section. Unlike Windows 10 and 8.1, the Region dialog box is the only place you can select built-in date and time formats.

要访问Windows 7中的日期和时间格式设置,请单击“开始”菜单按钮,然后在“搜索”框中输入“更改日期”(不带引号)。 然后,在结果列表中单击“更改日期,时间或数字格式”链接。 这将打开我们在下一部分中讨论的“区域”对话框。 与Windows 10和8.1不同,“区域”对话框是唯一可以选择内置日期和时间格式的位置。

13a_win7_clicking_change_date_from_search

如何在Windows 10、8.1和7中自定义日期和时间格式 (How to Customize the Date and Time Format in Windows 10, 8.1, and 7)

Now, we will set up a custom date using periods. If you’re using Windows 10 or 8.1, the Region dialog box should be open and the Formats tab should be active. If not, click on the “Formats” tab to activate it. Then, click “Additional settings” at the bottom of the tab.

现在,我们将使用句点设置自定义日期。 如果您使用的是Windows 10或8.1,则应该打开“区域”对话框,并且“格式”选项卡应该处于活动状态。 如果没有,请单击“格式”选项卡将其激活。 然后,点击标签底部的“其他设置”。

This dialog box also allows you to select built-in date and time formats just like the Change Date and Time Formats screen in PC Settings in Windows 10 and 8.1.

该对话框还允许您选择内置的日期和时间格式,就像Windows 10和8.1的“ PC设置”中的“更改日期和时间格式”屏幕一样。

14_clicking_additional_settings

On the Customize Format dialog box, click the “Date” tab.

在“自定义格式”对话框中,单击“日期”选项卡。

15_clicking_date_tab

In the Date formats section, the “Short date” drop-down list box is also an edit box, allowing you to enter a different format. So, type the format you want to use in the “Short date” box. In our example, we entered “M.d.yy”. A small legend displays below the Short date and Long date drop-down lists indicating what the letters used in the date format mean. The “dd” for the day adds a leading zero before single-digit months. You can also use “MM” to add a leading zero before single-digit months, even though that notation is not listed. For the year, “yyyy” uses the full, four-digit year and “yy” uses the last two digits of the year. For example, “MM.dd.yyyy” would display as “03.09.2016”. Once you’ve entered your custom format in the “Short date” box, click “Apply”.

在“日期格式”部分,“短日期”下拉列表框也是一个编辑框,可让您输入其他格式。 因此,在“短日期”框中键入要使用的格式。 在我们的示例中,我们输入了“ Mdyy”。 在“短日期”和“长日期”下拉列表下方显示一个小图例,指示日期格式中使用的字母的含义。 当天的“ dd”在单位数月份之前添加前导零。 即使未列出该符号,也可以使用“ MM”在个位数月份前添加前导零。 对于年份,“ yyyy”使用完整的四位数年份,“ yy”使用年份的后两位位数。 例如,“ MM.dd.yyyy”将显示为“ 03.09.2016”。 在“短日期”框中输入自定义格式后,点击“应用”。

NOTE: The Short date is what’s used to display the date in the notification area on the Taskbar. So, if you want to display a custom long date on the Taskbar, enter the long date you want to use in the “Short date” box, even if it’s one that’s available in the “Long date” drop-down list.

注意:短日期是用来在任务栏的通知区域中显示日期的日期。 因此,如果要在任务栏上显示自定义的长日期,请在“短日期”框中输入要使用的长日期,即使“长日期”下拉列表中可用。

16_entering_custom_date_format

The custom date format you entered displays in the Short date box in the Example section. You can also enter a custom time format by clicking the “Time” tab.

您输入的自定义日期格式显示在“示例”部分的“短日期”框中。 您还可以通过单击“时间”标签输入自定义时间格式。

17_format_changed

Enter a custom time in the “Short time” box using the notation listed on the dialog box. Once you’ve set up your custom date and time, click “OK” on the Customize Format dialog box.

使用对话框上列出的符号在“短时间”框中输入自定义时间。 设置自定义日期和时间后,在“自定义格式”对话框上单击“确定”。

18_time_tab

Click “OK” to close the Region dialog box. If the Control Panel and Settings windows are still open, click the “X” button in the upper-right corner of each window to close them.

单击“确定”关闭“区域”对话框。 如果“控制面板”和“设置”窗口仍处于打开状态,请单击每个窗口右上角的“ X”按钮以将其关闭。

19_closing_region_dialog

Our custom date format with the periods now displays in the notification area of the Taskbar.

现在,带有句点的自定义日期格式显示在任务栏的通知区域中。

20_new_date_format_on_clock

Note that when you change the date or time format back to a different format, after entering a custom format, the custom format is not preserved as a choice. You would have to enter it again to change to that custom format.

请注意,当您将日期或时间格式更改回另一种格式时,输入自定义格式后,自定义格式不会保留为选择。 您将不得不再次输入以更改为该自定义格式。

翻译自: https://www.howtogeek.com/247141/how-to-change-the-format-of-dates-and-times-in-windows/

vb更改日期时间格式

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值