将日期时间转换为双精度 [英] Convert DateTime to Double

查看:653
本文介绍了将日期时间转换为双精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从列表框中单击的项目创建了一个DateTime值。它的格式为 dd / MM / yyyy hh:mm:ss 。我想在十分钟时间放大,在中间点击的事件。我当前的代码如下(其中zoom_time是要在我的图表上放大的DateTime;

I've created a DateTime value from an item being clicked in a listBox. It's in the format dd/MM/yyyy hh:mm:ss. I'm want to zoom in on a ten minute period with the clicked event in the middle. My current code is as follows (where zoom_time is the DateTime to zoom to on my chart;

chart1.ChartAreas[0].AxisX.Minimum = (Convert.ToDouble(zoom_time.AddMinutes(-5)));
chart1.ChartAreas[0].AxisX.Maximum = (Convert.ToDouble(zoom_time.AddMinutes(5)));

这说明


无效转换从DateTime到双

"invalid cast from DateTime to double"

任何想法家伙?

推荐答案

您可以使用 DateTime.ToOADate(),如果您的意思是自动化日期由双开

You can use DateTime.ToOADate(), if you mean ole automation date by double

这篇关于将日期时间转换为双精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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