No | Name | Function | Example Output |
---|---|---|---|
1 | Current timestamp | DateTime.Now | 2025-06-13T15:22:18.5432109+05:30 |
2 | Today’s date | DateTime.Today | 2025-06-13T00:00:00 |
3 | Add 7 days | DateTime.Now.AddDays(7) | 2025-06-20T15:22:18.5432109+05:30 |
4 | Subtract 3 days | DateTime.Now.AddDays(-3) | 2025-06-10T15:22:18.5432109+05:30 |
5 | Add 2 months | DateTime.Now.AddMonths(2) | 2025-08-13T15:22:18.5432109+05:30 |
6 | Add 1 year | DateTime.Now.AddYears(1) | 2026-06-13T15:22:18.5432109+05:30 |
7 | Add 5.5 hours | DateTime.Now.AddHours(5.5) | 2025-06-13T20:52:18.5432109+05:30 |
8 | Add 30 minutes | DateTime.Now.AddMinutes(30) | 2025-06-13T15:52:18.5432109+05:30 |
9 | Add 45 seconds | DateTime.Now.AddSeconds(45) | 2025-06-13T15:23:03.5432109+05:30 |
10 | First day of month | New DateTime(DateTime.Now.Year, DateTime.Now.Month, 1) | 2025-06-01T00:00:00 |
11 | Last day of month | New DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)) | 2025-06-30T00:00:00 |
12 | Format as yyyy-MM-dd | DateTime.Now.ToString(“yyyy-MM-dd”) | “2025-06-13” |
13 | Format as dd-MMM-yyyy | DateTime.Now.ToString(“dd-MMM-yyyy”) | “13-Jun-2025” |
14 | Format as MM/dd/yyyy | DateTime.Now.ToString(“MM/dd/yyyy”) | “06/13/2025” |
15 | Format as HH:mm:ss | DateTime.Now.ToString(“HH:mm:ss”) | “15:22:18” |
16 | Format as full datetime | DateTime.Now.ToString(“F”) | “Friday, June 13, 2025 3:22:18 PM” |
17 | Parse date string | DateTime.Parse(“2025-12-25”) | 2025-12-25T00:00:00 |
18 | Parse exact format | DateTime.ParseExact(“25/12/2025”, “dd/MM/yyyy”, Nothing) | 2025-12-25T00:00:00 |
19 | Day of week | DateTime.Now.DayOfWeek | DayOfWeek.Friday |
20 | Day of week number | CInt(DateTime.Now.DayOfWeek) | 5 |
21 | Week of year | System.Globalization.CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(DateTime.Now, System.Globalization.CalendarWeekRule.FirstDay, DayOfWeek.Monday) | 24 |
22 | Is leap year | DateTime.IsLeapYear(DateTime.Now.Year) | FALSE |
23 | Days between dates | (endDate - startDate).TotalDays | 7.5 |
24 | UTC time | DateTime.UtcNow | 2025-06-13T09:52:18.5432109Z |
25 | Convert to UTC | DateTime.Now.ToUniversalTime() | 2025-06-13T09:52:18.5432109Z |
No | Name | Function | Example Output |
---|---|---|---|
26 | Convert from UTC | DateTime.SpecifyKind(utcDate, DateTimeKind.Utc).ToLocalTime() | 2025-06-13T15:22:18.5432109+05:30 |
27 | Current month name | DateTime.Now.ToString(“MMMM”) | “June” |
28 | Current day name | DateTime.Now.ToString(“dddd”) | “Friday” |
29 | Quarter of year | (DateTime.Now.Month - 1) \ 3 + 1 | 2 |
30 | Days in month | DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month) | 30 |
31 | Is daylight saving | TimeZoneInfo.Local.IsDaylightSavingTime(DateTime.Now) | FALSE |
32 | Timezone offset | TimeZoneInfo.Local.GetUtcOffset(DateTime.Now) | 05:30:00 |
33 | Unix timestamp | CInt((DateTime.Now - New DateTime(1970,1,1)).TotalSeconds) | 1850000000 |
34 | From Unix timestamp | New DateTime(1970,1,1).AddSeconds(unixTimestamp) | 2025-06-13T15:22:18 |
35 | Start of week | DateTime.Now.AddDays(-CInt(DateTime.Now.DayOfWeek)) | 2025-06-08T00:00:00 |
36 | End of week | DateTime.Now.AddDays(6 - CInt(DateTime.Now.DayOfWeek)) | 2025-06-14T23:59:59 |
37 | Age calculation | DateTime.Now.Year - birthDate.Year - (If(DateTime.Now.DayOfYear < birthDate.DayOfYear, 1, 0)) | 35 |
38 | Is weekend | DateTime.Now.DayOfWeek = DayOfWeek.Saturday Or DateTime.Now.DayOfWeek = DayOfWeek.Sunday | FALSE |
39 | Business days between | Enumerable.Range(0, CInt((endDate - startDate).TotalDays + 1)).Count(Function(d) (startDate.AddDays(d).DayOfWeek <> DayOfWeek.Saturday) And (startDate.AddDays(d).DayOfWeek <> DayOfWeek.Sunday)) | 5 |
40 | Fiscal year start | New DateTime(If(DateTime.Now.Month < 4, DateTime.Now.Year - 1, DateTime.Now.Year), 4, 1) | 01-04-2025 |
41 | Fiscal year end | New DateTime(If(DateTime.Now.Month < 4, DateTime.Now.Year, DateTime.Now.Year + 1), 3, 31) | 31-03-2026 |
42 | Fiscal quarter | (DateTime.Now.Month - 1) \ 3 + 1 | 2 |
43 | Is date valid | DateTime.TryParse(dateString, Nothing) | TRUE |
44 | Compare dates | DateTime.Compare(date1, date2) | -1 (if date1 < date2) |
45 | Max of two dates | If(date1 > date2, date1, date2) | 15-06-2025 |
46 | Time difference | (endTime - startTime).TotalHours | 3.5 |
47 | Round to hour | New DateTime(DateTime.Now.Ticks - (DateTime.Now.Ticks Mod TimeSpan.TicksPerHour)) | 2025-06-13T15:00:00 |
48 | Round to minute | New DateTime(DateTime.Now.Ticks - (DateTime.Now.Ticks Mod TimeSpan.TicksPerMinute)) | 2025-06-13T15:22:00 |
49 | Truncate seconds | date.AddTicks(-(date.Ticks % TimeSpan.TicksPerMinute)) | 2025-06-13T15:22:00 |
50 | Midnight | DateTime.Today | 2025-06-13T00:00:00 |
No | Name | Function | Example Output |
---|---|---|---|
51 | Noon | DateTime.Today.AddHours(12) | 2025-06-13T12:00:00 |
52 | End of day | DateTime.Today.AddDays(1).AddTicks(-1) | 2025-06-13T23:59:59 |
53 | Start of year | New DateTime(DateTime.Now.Year, 1, 1) | 01-01-2025 |
54 | End of year | New DateTime(DateTime.Now.Year, 12, 31) | 31-12-2025 |
55 | Is same day | date1.Date = date2.Date | TRUE |
56 | Days in year | If(DateTime.IsLeapYear(DateTime.Now.Year), 366, 365) | 365 |
57 | Weekday name | DateTime.Now.ToString(“dddd”) | “Friday” |
58 | Month name | DateTime.Now.ToString(“MMMM”) | “June” |
59 | 12-hour clock | DateTime.Now.ToString(“hh:mm tt”) | “03:22 PM” |
60 | 24-hour clock | DateTime.Now.ToString(“HH:mm”) | “15:22” |
61 | ISO 8601 format | DateTime.Now.ToString(“o”) | “2025-06-13T15:22:18.5432109+05:30” |
62 | RFC 1123 format | DateTime.Now.ToString(“R”) | “Fri, 13 Jun 2025 15:22:18 GMT” |
63 | Sortable format | DateTime.Now.ToString(“s”) | “2025-06-13T15:22:18” |
64 | Universal sortable | DateTime.Now.ToString(“u”) | “2025-06-13 15:22:18Z” |
65 | Year only | DateTime.Now.Year | 2025 |
66 | Month only | DateTime.Now.Month | 6 |
67 | Day only | DateTime.Now.Day | 13 |
68 | Hour only | DateTime.Now.Hour | 15 |
69 | Minute only | DateTime.Now.Minute | 22 |
70 | Second only | DateTime.Now.Second | 18 |
71 | Millisecond only | DateTime.Now.Millisecond | 543 |
72 | Ticks | DateTime.Now.Ticks | 6.37921E+17 |
73 | Day of year | DateTime.Now.DayOfYear | 164 |
74 | Is morning | DateTime.Now.Hour < 12 | FALSE |
75 | Is afternoon | DateTime.Now.Hour >= 12 And DateTime.Now.Hour < 17 | TRUE |
No | Name | Function | Example Output |
---|---|---|---|
76 | Is evening | DateTime.Now.Hour >= 17 And DateTime.Now.Hour < 21 | FALSE |
77 | Is night | DateTime.Now.Hour >= 21 Or DateTime.Now.Hour < 5 | FALSE |
78 | Time since event | DateTime.Now - eventTime | 2.03:45:00 |
79 | Time until event | eventTime - DateTime.Now | 1.12:30:00 |
80 | Average date | New DateTime((date1.Ticks + date2.Ticks) / 2) | 2025-06-13T15:22:18 |
81 | Next occurrence of day | DateTime.Today.AddDays((targetDay - DateTime.Today.DayOfWeek + 7) Mod 7) | 2025-06-16 (if targetDay=Monday) |
82 | Previous occurrence of day | DateTime.Today.AddDays(-((DateTime.Today.DayOfWeek - targetDay + 7) Mod 7)) | 2025-06-09 (if targetDay=Monday) |
83 | Nth weekday of month | New DateTime(year, month, 1).AddDays((nthWeek - 1) * 7 + (targetDay - New DateTime(year, month, 1).DayOfWeek + 7) Mod 7) | 2025-06-16 (2nd Monday) |
84 | Last weekday of month | New DateTime(year, month, DateTime.DaysInMonth(year, month)).AddDays(-((New DateTime(year, month, DateTime.DaysInMonth(year, month)).DayOfWeek - targetDay + 7) Mod 7) | 2025-06-30 (last Monday) |
85 | Timezone conversion | TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById(“Pacific Standard Time”)) | 2025-06-13T02:52:18 |
86 | All timezones | String.Join(", ", TimeZoneInfo.GetSystemTimeZones().Select(Function(tz) tz.Id)) | “UTC, GMT Standard Time, …” |
87 | System uptime | TimeSpan.FromMilliseconds(Environment.TickCount) | 34:56.8 |
88 | File creation time | System.IO.File.GetCreationTime(“C:\file.txt”) | 2025-06-10T09:15:22 |
89 | Process start time | System.Diagnostics.Process.GetCurrentProcess().StartTime | 2025-06-13T09:00:00 |
90 | High-precision timer | System.Diagnostics.Stopwatch.StartNew() | (Stopwatch object) |
91 | Time since midnight | DateTime.Now - DateTime.Today | 22:18.5 |
92 | Time until midnight | DateTime.Today.AddDays(1) - DateTime.Now | 37:41.5 |
93 | Easter date | Function to calculate Easter (complex - requires algorithm) | 20-04-2025 |
94 | Holidays calculator | New List(Of DateTime) From {New DateTime(DateTime.Now.Year, 1, 1), New DateTime(DateTime.Now.Year, 7, 4), New DateTime(DateTime.Now.Year, 12, 25)}.Contains(DateTime.Today) | |
95 | Min of two dates | If(date1 < date2, date1, date2) | 10-06-2025 |