c# - C#中的日期时间格式

标签 c# datetime-format

我需要“ 24/01/2012”,但为什么总是返回“ 24/1/2012”

当我使用这个

txtFilingStartDate.Text = String.Format("{0:dd/MM/yyyy}", (SessionHelper.SearchFilingStartDate.Value.Day.ToString() + "/" + SessionHelper.SearchFilingStartDate.Value.Month.ToString() + "/" + SessionHelper.SearchFilingStartDate.Value.Year.ToString()));

最佳答案

只需这样做:

txtFilingStartDate.Text = String.Format("{0:dd/MM/yyyy}",SessionHelper.SearchFilingStartDate.Value);

关于c# - C#中的日期时间格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34921860/

相关文章:

c# - ElasticSearch NEST API 将值更新为空

c# - XPath 查找所有匹配项 C# XmlDocument

c# - 在 .Net Core/EF Core 中设置多个相同类的外键

javascript - Safari 中的日期显示为使用 Intl.DateTimeFormat 和 en-US 语言环境

c# - 使用 DateTime.ToString ("tt"时,Windows 10 中的时间输出(AM/PM)发生了变化)

python - Python Pandas 中的时间格式化

C# DefaultValue 属性不起作用

c# - 将 2 个带有内部列表的字典与 Diff 字典进行比较?

c# - 使用 DateTime 格式化问题日期

flutter - 如何在flutter中获取当月的所有日期和工作日