にTimeUuid
変換する必要がある がありDateTime
ます。
C#でこれを行う方法はありますか?
私はDataStax の CassandraCsharpDriverTimeUuid
を使用していますが、 を に変換する機能はありませんDatetime
が、逆は可能です。
UUID の例:d91027c5-bd42-11e6-90be-2b4914b28d57
にTimeUuid
変換する必要がある がありDateTime
ます。
C#でこれを行う方法はありますか?
私はDataStax の CassandraCsharpDriverTimeUuid
を使用していますが、 を に変換する機能はありませんDatetime
が、逆は可能です。
UUID の例:d91027c5-bd42-11e6-90be-2b4914b28d57
値の表現を返す構造体のGetDate()
メソッドを使用できます。TimeUuid
DateTimeOffset
TimeUuid uuidValue = row.GetValue<TimeUuid>("time");
// TimeUuid structure exposes GetDate() method
DateTimeOffset dateOffset = uuidValue.GetDate();
DateTime dateTime = dateOffset.DateTime;
GetDateTime
これらの 2 つのヘルパーを使用して、次のメソッドを使用して datetime に変換できます。
コード:
String uuidString = "28442f00-2e98-11e2-0000-89a3a6fab5ef";
Guid gui = new Guid(uuidString);
DateTime dt = GuidGenerator.GetDateTime(gui);