简体   繁体   中英

How to set a cell in Excel to a particular date format using C#?

I need to show the date in excel sheet in following format:

在此处输入图片说明

The values are being set but sometimes they appear as

在此处输入图片说明

How can I programmatically set the format of date displayed to DD/MM/YYYY ?

您可能必须在范围上使用NumberFormat显式设置格式。

range.NumberFormat = "DD/MM/YYYY";

尝试这个:

=TEXT("7-20-2019", "DD/MM/YYYY")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM