如何将Date转换为int [英] How to convert Date to int
本文介绍了如何将Date转换为int的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
C#的新手----如何将Date转换为int?
在VB6中:
Dim lDate
lDate = CLng(日期)
在C#
int lDate;
然后是什么?
先谢谢。
New to C# ---- How do I convert a Date to int?
In VB6:
Dim lDate as long
lDate = CLng(Date)
In C#
int lDate;
Then what?
Thanks In Advance.
推荐答案
试试Convert.ToInt32(DateTime)
http:// msdn2.microsoft.com/en-us/lib...t.toint32.aspx
Jeff
Terry Jolly写道:
Try Convert.ToInt32(DateTime)
http://msdn2.microsoft.com/en-us/lib...t.toint32.aspx
Jeff
Terry Jolly wrote:
C#的新手----如何将Date转换为int?
在VB6中:
Dim lDate as long
lDate = CLng(日期)
在C#
int lDate;
然后是什么?
在此先感谢。
New to C# ---- How do I convert a Date to int?
In VB6:
Dim lDate as long
lDate = CLng(Date)
In C#
int lDate;
Then what?
Thanks In Advance.
应该注意的是,当
$ b时你将丢失时间信息$ b你这样做(并且有也没办法阻止这种情况。
-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com
" Jeff" <菊****** @ jeff.net>在消息中写道
新闻:PK ***************** @ tornado.texas.rr.com ...
It should be noted that you are going to lose the time information when
you do this (and there is no way to prevent that, either).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Jeff" <ju******@jeff.net> wrote in message
news:PK*****************@tornado.texas.rr.com...
尝试Convert.ToInt32(DateTime)
http://msdn2.microsoft.com/en-us/lib...t.toint32.aspx
杰夫
特里Jolly写道:
Try Convert.ToInt32(DateTime)
http://msdn2.microsoft.com/en-us/lib...t.toint32.aspx
Jeff
Terry Jolly wrote:
C#的新手----如何将Date转换为int?
在VB6中:
Dim lDate
lDate = CLng(日期)
在C#
int lDate;
那又怎样?
在此先感谢。
New to C# ---- How do I convert a Date to int?
In VB6:
Dim lDate as long
lDate = CLng(Date)
In C#
int lDate;
Then what?
Thanks In Advance.
我在编译时收到错误:无法隐式转换类型
''System.DateTime''到''int''" -----任何其他想法?
" Jeff" <菊****** @ jeff.net>在消息中写道
新闻:PK ***************** @ tornado.texas.rr.com ...
I get an error on compling: "Cannot implicitly convert type
''System.DateTime'' to ''int'' " ----- Any other ideas?
"Jeff" <ju******@jeff.net> wrote in message
news:PK*****************@tornado.texas.rr.com...
尝试Convert.ToInt32(DateTime)
http://msdn2.microsoft.com/en-us/lib...t.toint32.aspx
杰夫
特里Jolly写道:
Try Convert.ToInt32(DateTime)
http://msdn2.microsoft.com/en-us/lib...t.toint32.aspx
Jeff
Terry Jolly wrote:
C#的新手----如何将Date转换为int?
在VB6中:
Dim lDate
lDate = CLng(日期)
在C#
int lDate;
那又怎样?
先谢谢。
New to C# ---- How do I convert a Date to int?
In VB6:
Dim lDate as long
lDate = CLng(Date)
In C#
int lDate;
Then what?
Thanks In Advance.
这篇关于如何将Date转换为int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文