我想知道,有没有办法在日期时间在c#中创建时间戳?我需要一个毫秒精度值,它也可以在Compact Framework中工作(说因为CF中不存在DateTime.ToBinary()).
我的问题是我想以数据库无关的方式存储这个值,所以我可以稍后对其进行排序,并找出哪个值来自另一个等等.
c# timestamp compact-framework time-precision database-agnostic
我需要在Int中存储DateTime.所以我试过下面的代码
Int64 n = Int64.Parse(DateTime.Today.ToString("dd-MM-yyyy"));
Run Code Online (Sandbox Code Playgroud)
要么
Int64 twoday_date=Convert.ToInt64(System.DateTime.Today.ToString("dd-MM-yyyy"));
Run Code Online (Sandbox Code Playgroud)
但它显示错误:
输入字符串的格式不正确.
错误在哪里?