[問題] c# datetime ticks轉換
各位大大
請教一下C#的Datetime ticks該怎麼轉換到 java的去呢??
找了一些文章 C# & JAVA的基準值不一樣
也找了另一個函式庫Joda-time,但不曉得如何轉換
故上來請教高手
謝謝
C#範例
static string GetDateTime()
{
DateTime now = DateTime.Now;
DateTime withoutYear =
new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Se
co
long t = withoutYear.Ticks / (long)20000000;
return ((UInt32)t).ToString("X000000");
}
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 122.121.217.210
※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1494660040.A.411.html
→
05/14 01:07, , 1F
05/14 01:07, 1F
→
05/14 01:55, , 2F
05/14 01:55, 2F
→
05/14 01:57, , 3F
05/14 01:57, 3F
→
05/14 02:05, , 4F
05/14 02:05, 4F
→
05/14 02:12, , 5F
05/14 02:12, 5F
→
05/14 02:18, , 6F
05/14 02:18, 6F
→
05/14 02:19, , 7F
05/14 02:19, 7F
→
05/14 02:22, , 8F
05/14 02:22, 8F
→
05/14 02:23, , 9F
05/14 02:23, 9F
→
05/16 22:14, , 10F
05/16 22:14, 10F
所以我只要把java的ticks / 10000嗎?
※ 編輯: areyo (122.121.219.46), 05/16/2017 22:21:08
→
05/17 18:21, , 11F
05/17 18:21, 11F
→
05/17 21:35, , 12F
05/17 21:35, 12F
→
05/17 21:36, , 13F
05/17 21:36, 13F
→
05/17 21:36, , 14F
05/17 21:36, 14F
→
05/17 21:39, , 15F
05/17 21:39, 15F
AndroidDev 近期熱門文章
PTT數位生活區 即時熱門文章