c# - 日期时间格式转换

标签 c# c#-4.0

我想在 DateTime 中转换以下格式。我想将它转换为日期时间

"08-22T03:32"

最佳答案

由于您的日期字符串中没有年份,因此默认为当前年份,如下所示:

DateTime dt = DateTime.ParseExact(dateString, "MM-ddTHH:mm", CultureInfo.InvariantCulture);

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

相关文章:

c# - 从部署项目安装目录

C# TCP 读取所有数据 - 服务器端问题

c# - 在不同的类中实现 INotifyPropertyChanged

c# - "the term ' 添加迁移 ' is not recognized as the name of a cmdlet" Visual Studio 2019

c# - 最轻量级的 .NET 集合

c# - 启动 SQL Server 导入/导出向导?

c# - DataGridView 列页脚 c#.net winforms

c#-4.0 - 抽象工厂设计模式有哪些缺点?

c# - 我想要第二个列表中的项目,其中包含第一个列表中的所有项目

c# - 使用 C#.net 从 Sharepoint Online 下载文件?