本文整理汇总了C#中System.TimeZone.ToLocalTime方法的典型用法代码示例。如果您正苦于以下问题:C# TimeZone.ToLocalTime方法的具体用法?C# TimeZone.ToLocalTime怎么用?C# TimeZone.ToLocalTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.TimeZone
的用法示例。
在下文中一共展示了TimeZone.ToLocalTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OccursBetween
public static bool OccursBetween(Entry entry, TimeZone timeZone,
DateTime startDateTime, DateTime endDateTime)
{
return ((timeZone.ToLocalTime(entry.CreatedUtc) >= startDateTime)
&& (timeZone.ToLocalTime(entry.CreatedUtc) <= endDateTime));
}
示例2: foreach
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();
}
示例3: OccursBefore
/// <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);
}
示例4: ToLocal
/// <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);
}