小编Muh*_*ais的帖子

我正在尝试将字符串(“08:55 AM”)转换为时间跨度

我必须将字符串值转换为TimeSpan. 但它显示错误。

字符串未被识别为有效的时间跨度。

代码是:

TimeSpan _time = TimeSpan.Parse("08:55 AM");
Run Code Online (Sandbox Code Playgroud)

我知道它可以解析 中的字符串值"08:55"。但我不需要那个。我必须在字符串中使用 AM 或 PM。在数据库中,列数据类型是time(7),我正在使用entity framework.

c# asp.net time entity-framework

4
推荐指数
1
解决办法
8455
查看次数

标签 统计

asp.net ×1

c# ×1

entity-framework ×1

time ×1