public static DateTime FromUnix(Double TimeStamp, System.TimeZone Zone) { DateTime d = Convert.ToDateTime("1970-01-01T00:00:00Z"); TimeSpan t = new TimeSpan(( long )(( Double )TimeStamp * ( Double )10000000)); d = d.ToUniversalTime(); d = d.Add(t); return(Zone.ToLocalTime(d)); }
static public int ToLocalTime(IntPtr l) { try { System.TimeZone self = (System.TimeZone)checkSelf(l); System.DateTime a1; checkValueType(l, 2, out a1); var ret = self.ToLocalTime(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static int ToLocalTime(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); System.TimeZone obj = (System.TimeZone)ToLua.CheckObject <System.TimeZone>(L, 1); System.DateTime arg0 = StackTraits <System.DateTime> .Check(L, 2); System.DateTime o = obj.ToLocalTime(arg0); ToLua.PushValue(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static StackObject *ToLocalTime_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.DateTime @time = (System.DateTime) typeof(System.DateTime).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); System.TimeZone instance_of_this_method = (System.TimeZone) typeof(System.TimeZone).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.ToLocalTime(@time); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
public static bool OccursBetween(Entry entry, TimeZone timeZone, DateTime startDateTime, DateTime endDateTime) { return ((timeZone.ToLocalTime(entry.CreatedUtc) >= startDateTime) && (timeZone.ToLocalTime(entry.CreatedUtc) <= endDateTime)); }
/// <summary> /// Returns true if the entry is in the categoryName specified. /// </summary> /// <param name="entry">The entry to check for category</param> /// <param name="timeZone">The time zone.</param> /// <param name="dateTime">The latest date and time the entry can occur.</param> /// <returns> /// A value of true indicates the entry is in the category specified or, if the categoryName /// is null or empty, return true if the entry is assigned no categories /// </returns> public static bool OccursBefore(Entry entry, TimeZone timeZone, DateTime dateTime) { return (timeZone.ToLocalTime(entry.CreatedUtc) <= dateTime); }
DateTime[] IBlogDataService.GetDaysWithEntries(TimeZone tz) { EntryCollection idCache = ((IBlogDataService)this).GetEntries(false); List<DateTime> dayList = new List<DateTime>(); foreach (Entry entry in idCache) { DateTime tzTime = tz.ToLocalTime(entry.CreatedUtc).Date; if (!dayList.Contains(tzTime)) { dayList.Add(tzTime); } } return dayList.ToArray(); }
/// <summary> /// Automatics the local. /// </summary> /// <param name="universal">The universal.</param> /// <param name="timezone">The timezone.</param> /// <param name="min">The minimum.</param> /// <param name="max">The maximum.</param> /// <returns></returns> private static DateTime ToLocal(DateTime universal, TimeZone timezone, DateTime min, DateTime max) { if (TimeInterval.SaturateDateTime(ref universal, min, max)) { return DateTime.SpecifyKind(universal, DateTimeKind.Local); } return timezone.ToLocalTime(universal); }