コード例 #1
0
        public const long UnixEpochDateTimeTicks = 0x89f7ff5f7b58000L;  // == new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).Ticks

        public static string HowLongAgo(DateTime p_timeUtc, DateTime?p_utcNow = null)
        {
            if (p_timeUtc == DateTime.MinValue)
            {
                return("never");
            }
            TimeSpan age = (p_utcNow ?? DateTime.UtcNow) - p_timeUtc;

            return((TimeSpan.Zero <= age && age < Utils.g_1day) ? age.RoundToSecond() + " ago"
                                                                : "at " + Utils.UtcDateTime2Str(p_timeUtc));
        }
コード例 #2
0
 public override string ToString()
 {
     return(Utils.UtcDateTime2Str(this.DateTime));
 }