本文整理汇总了C#中DateTime.GetMinutes方法的典型用法代码示例。如果您正苦于以下问题:C# DateTime.GetMinutes方法的具体用法?C# DateTime.GetMinutes怎么用?C# DateTime.GetMinutes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTime
的用法示例。
在下文中一共展示了DateTime.GetMinutes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToXrmString
public static string ToXrmString(DateTime date)
{
// Get a date string from the Date object
//2011-04-20T14:00:00Z
// NOTE: we assume that the local date is in fact converted to UTC already
// This avoids any local browser timezone missmatches with the user settings timezone
string month = DateTimeEx.PadNumber(date.GetMonth() + 1, 2);
string day = DateTimeEx.PadNumber(date.GetDate(), 2);
string hours = DateTimeEx.PadNumber(date.GetHours(), 2);
string mins = DateTimeEx.PadNumber(date.GetMinutes(), 2);
string secs = DateTimeEx.PadNumber(date.GetSeconds(), 2);
return String.Format("{0}-{1}-{2}T{3}:{4}:{5}Z", date.GetFullYear(), month, day, hours, mins, secs);
}
示例2: GetTimeDuration
/// <summary>
/// Gets the duration since midnight in seconds
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
public static int GetTimeDuration(DateTime date)
{
return (date.GetHours() * (60 * 60)) + (date.GetMinutes() * 60) + (date.GetSeconds());
}
示例3: SetTime
public static void SetTime(DateTime date, DateTime time)
{
if (date != null && time != null)
{
date.SetHours(time.GetHours());
date.SetMinutes(time.GetMinutes());
date.SetSeconds(time.GetSeconds());
date.SetMilliseconds(time.GetMilliseconds());
}
}