本文整理汇总了C#中System.Globalization.GregorianCalendar.GetSecond方法的典型用法代码示例。如果您正苦于以下问题:C# GregorianCalendar.GetSecond方法的具体用法?C# GregorianCalendar.GetSecond怎么用?C# GregorianCalendar.GetSecond使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Globalization.GregorianCalendar
的用法示例。
在下文中一共展示了GregorianCalendar.GetSecond方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EncodeTime
public static int EncodeTime(DateTime d)
{
GregorianCalendar calendar = new GregorianCalendar();
int millisInDay =
(int)(calendar.GetHour(d) * 3600000 +
calendar.GetMinute(d) * 60000 +
calendar.GetSecond(d) * 1000 +
calendar.GetMilliseconds(d)) * 10;
return millisInDay;
}
示例2: ShamsiTogregorian
public DateTime ShamsiTogregorian(DateTime date)
{
PersianCalendar pc = new PersianCalendar();
GregorianCalendar gcalendar = new GregorianCalendar();
DateTime eDate = pc.ToDateTime(
gcalendar.GetYear(date),
gcalendar.GetMonth(date),
gcalendar.GetDayOfMonth(date),
gcalendar.GetHour(date),
gcalendar.GetMinute(date),
gcalendar.GetSecond(date), 0);
return eDate;
}
示例3: DateTimeToTimeSpan
public static TimeSpan DateTimeToTimeSpan(DateTime d)
{
GregorianCalendar calendar = new GregorianCalendar();
return new TimeSpan(0, calendar.GetHour(d), calendar.GetMinute(d), calendar.GetSecond(d), (int)calendar.GetMilliseconds(d));
}
示例4: GetChristianDateTime
public static DateTime GetChristianDateTime(string _Fdate)
{
_Fdate = _Fdate.Trim().Replace(':', '/').Replace('-', '/').Replace(' ', '/');
var dateArray = new string[6];
if (_Fdate.Length <= 10)
{
_Fdate = _Fdate + "/0/0/0";
}
dateArray = _Fdate.Split('/');
PersianCalendar pcalendar = new PersianCalendar();
GregorianCalendar gcalendar = new GregorianCalendar();
DateTime eDate = pcalendar.ToDateTime(
gcalendar.GetYear(new DateTime(int.Parse(dateArray[0]), 1, 1)),
gcalendar.GetMonth(new DateTime(1395, int.Parse(dateArray[1]), 1)),
gcalendar.GetDayOfMonth(new DateTime(1395, 1, int.Parse(dateArray[2]))),
gcalendar.GetHour(new DateTime(1395, 1, 1, int.Parse(dateArray[3]), 0, 0)),
gcalendar.GetMinute(new DateTime(1395, 1, 1, 1, int.Parse(dateArray[4]), 0)),
gcalendar.GetSecond(new DateTime(1395, 1, 1, 1, 1, int.Parse(dateArray[5]))), 0);
return eDate;
}