Class DateTimeExtension
Namespace: Tool
Assembly: Tool.Net.dll
对DateTime进行升级
public static class DateTimeExtensionInheritance
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Extension Methods
ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)
Remarks
代码由逆血提供支持
Methods
Add(DateTime[], DateTime)
给数组加新的值
public static DateTime[] Add(this DateTime[] txt, DateTime txt1)Parameters
txt DateTime[]
DateTime[]
txt1 DateTime
新增的值
Returns
DateTime[]
Contains(DateTime[], DateTime)
查找该char数组中是否存在该值。
public static bool Contains(this DateTime[] txt, DateTime txt1)Parameters
txt DateTime[]
DateTime[]
txt1 DateTime
查找的字符
Returns
方法存在或不存在
DateMonday(DateTime, DayOfWeek)
返回当前日期指定的星期几
public static DateTime DateMonday(this DateTime dateTime, DayOfWeek Week)Parameters
dateTime DateTime
DateTime
Week DayOfWeek
指定星期几
Returns
返回当前日期指定的星期几
GetArrayIndex(DateTime[], int, int)
同于获取指定部分的内容
public static DateTime[] GetArrayIndex(this DateTime[] obj, int index, int count)Parameters
obj DateTime[]
对象数组
index int
从下标N开始
count int
到下标N结束
Returns
DateTime[]
返回一部分的数组内容
GetDaysOfMonth(DateTime)
本月有多少天
public static int GetDaysOfMonth(this DateTime dt)Parameters
dt DateTime
日期
Returns
天数
GetDaysOfYear(DateTime)
本年有多少天
public static int GetDaysOfYear(this DateTime idt)Parameters
idt DateTime
日期
Returns
本天在当年的天数
GetMilliseconds(DateTime)
根据实力,计算与当前时间的毫秒差
public static double GetMilliseconds(this DateTime dateTime)Parameters
dateTime DateTime
DateTime
Returns
适用于获取代码执行时的耗时
GetWeekNameOfDay(DateTime)
返回当前日期的星期名称
public static string GetWeekNameOfDay(this DateTime idt)Parameters
idt DateTime
日期
Returns
星期名称
GetWeekNumberOfDay(DateTime)
返回当前日期的星期编号
public static string GetWeekNumberOfDay(this DateTime idt)Parameters
idt DateTime
日期
Returns
星期数字编号
ToLocalTime(double, bool)
返回 类型 ,根据指定时间数字转换
public static DateTime ToLocalTime(double Localtime, bool tal)Parameters
Localtime double
指定的时间数字
tal bool
true 毫秒, false 秒。
Returns
返回时间类型
ToLocalTime(DateTime, bool)
返回 类型 ,根据指定时间数字转换
public static long ToLocalTime(this DateTime dateTime, bool tal)Parameters
dateTime DateTime
时间类型
tal bool
返回 true 毫秒, false 秒。
Returns
返回64位时间数字