将字符串转换为F#中的System.DateTime [英] convert string to System.DateTime in F#

查看:105
本文介绍了将字符串转换为F#中的System.DateTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我从命令行得到一个字符串,它看起来像这样:

if I get a string from the command line and it looks like this:

'1-1-2011'

如何将该字符串转换为F#中的DateTime对象?

how can I convert that string to a DateTime object in F#?

推荐答案

你可以这样做:

let dateTime = System.DateTime.Parse "1-1-2011"

这篇关于将字符串转换为F#中的System.DateTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆