Function that creates a timestamp in c#
问题 I was wondering, is there a way to create a timestamp in c# from a datetime? I need a millisecond precision value that also works in Compact Framework(saying that since DateTime.ToBinary() does not exist in CF). My problem is that i want to store this value in a database agnostic way so i can sortby it later and find out which value is greater from another etc. 回答1: I always use something like the following: public static String GetTimestamp(this DateTime value) { return value.ToString(