Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
DateHelper Class Reference

Static Public Member Functions

static string GetLastTime (long time)
 

Static Private Attributes

const int SECOND = 1
 
const int MINUTE = 60
 
const int HOUR = 3600
 
const int DAY = 86400
 
const int MONTH = 2592000
 

Detailed Description

Definition at line 3 of file DateHelper.cs.

Member Function Documentation

◆ GetLastTime()

static string DateHelper.GetLastTime ( long  time)
inlinestatic

Definition at line 15 of file DateHelper.cs.

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 }

Member Data Documentation

◆ DAY

const int DateHelper.DAY = 86400
staticprivate

Definition at line 11 of file DateHelper.cs.

◆ HOUR

const int DateHelper.HOUR = 3600
staticprivate

Definition at line 9 of file DateHelper.cs.

◆ MINUTE

const int DateHelper.MINUTE = 60
staticprivate

Definition at line 7 of file DateHelper.cs.

◆ MONTH

const int DateHelper.MONTH = 2592000
staticprivate

Definition at line 13 of file DateHelper.cs.

◆ SECOND

const int DateHelper.SECOND = 1
staticprivate

Definition at line 5 of file DateHelper.cs.


The documentation for this class was generated from the following file: