Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
DateHelper.cs
Go to the documentation of this file.
1using System;
2
3public class DateHelper
4{
5 private const int SECOND = 1;
6
7 private const int MINUTE = 60;
8
9 private const int HOUR = 3600;
10
11 private const int DAY = 86400;
12
13 private const int MONTH = 2592000;
14
15 public static string GetLastTime(long time)
16 {
17 TimeSpan timeSpan = new TimeSpan(DateTime.UtcNow.Ticks - time);
18 double num = Math.Abs(timeSpan.TotalSeconds);
19 if (num < 60.0)
20 {
21 if (timeSpan.Seconds != 1)
22 {
23 return timeSpan.Seconds + " seconds ago";
24 }
25 return "one second ago";
26 }
27 if (num < 120.0)
28 {
29 return "a minute ago";
30 }
31 if (num < 2700.0)
32 {
33 return timeSpan.Minutes + " minutes ago";
34 }
35 if (num < 5400.0)
36 {
37 return "an hour ago";
38 }
39 if (num < 86400.0)
40 {
41 return timeSpan.Hours + " hours ago";
42 }
43 if (num < 172800.0)
44 {
45 return "yesterday";
46 }
47 if (num < 2592000.0)
48 {
49 return timeSpan.Days + " days ago";
50 }
51 if (num < 31104000.0)
52 {
53 int num2 = Convert.ToInt32(Math.Floor((double)timeSpan.Days / 30.0));
54 if (num2 > 1)
55 {
56 return num2 + " months ago";
57 }
58 return "one month ago";
59 }
60 int num3 = Convert.ToInt32(Math.Floor((double)timeSpan.Days / 365.0));
61 if (num3 > 1)
62 {
63 return num3 + " years ago";
64 }
65 return "one year ago";
66 }
67}
static string GetLastTime(long time)
Definition: DateHelper.cs:15
const int SECOND
Definition: DateHelper.cs:5
const int MONTH
Definition: DateHelper.cs:13
const int MINUTE
Definition: DateHelper.cs:7
const int DAY
Definition: DateHelper.cs:11
const int HOUR
Definition: DateHelper.cs:9