C# DateTime.Millisecond屬性代碼示例- 純淨天空
文章推薦指數: 80 %
C# DateTime.Millisecond屬性代碼示例,System.DateTime.Millisecond用法.
當前位置:首頁>>代碼示例>>C#>>正文
本文整理匯總了C#中System.DateTime.Millisecond屬性的典型用法代碼示例。
如果您正苦於以下問題:C#DateTime.Millisecond屬性的具體用法?C#DateTime.Millisecond怎麽用?C#DateTime.Millisecond使用的例子?那麽恭喜您,這裏精選的屬性代碼示例或許可以為您提供幫助。
您也可以進一步了解該屬性所在類System.DateTime的用法示例。
在下文中一共展示了DateTime.Millisecond屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。
您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的C#代碼示例。
示例1:
點讚16
System.DateTimemoment=newSystem.DateTime(
1999,1,13,3,57,32,11);
//Yeargets1999.
intyear=moment.Year;
//Monthgets1(January).
intmonth=moment.Month;
//Daygets13.
intday=moment.Day;
//Hourgets3.
inthour=moment.Hour;
//Minutegets57.
intminute=moment.Minute;
//Secondgets32.
intsecond=moment.Second;
//Millisecondgets11.
intmillisecond=moment.Millisecond;開發者ID:.NET開發者,項目名稱:System,代碼行數:22,代碼來源:DateTime.Millisecond
示例2:DateTime
點讚15
DateTimedate1=newDateTime(2008,1,1,0,30,45,125);
Console.WriteLine("Milliseconds:{0:fff}",
date1);//displaysMilliseconds:125開發者ID:.NET開發者,項目名稱:System,代碼行數:3,代碼來源:DateTime.Millisecond
示例3:DateTime
點讚13
DateTimedate2=newDateTime(2008,1,1,0,30,45,125);
Console.WriteLine("Date:{0:o}",
date2);開發者ID:.NET開發者,項目名稱:System,代碼行數:3,代碼來源:DateTime.Millisecond輸出:
Date:2008-01-01T00:30:45.1250000
示例4:DateTime
點讚13
DateTimedate3=newDateTime(2008,1,1,0,30,45,125);
Console.WriteLine("Datewithmilliseconds:{0:MM/dd/yyyHH:mm:ss.fff}",
date3);開發者ID:.NET開發者,項目名稱:System,代碼行數:3,代碼來源:DateTime.Millisecond輸出:
Datewithmilliseconds:01/01/200800:30:45.125
示例5:DisplayDateTime
點讚11
//引入命名空間
usingSystem;
classMainClass{
publicstaticvoidDisplayDateTime(stringname,DateTimemyDateTime){
Console.WriteLine(name+"="+myDateTime);
Console.WriteLine(name+".Year="+myDateTime.Year);
Console.WriteLine(name+".Month="+myDateTime.Month);
Console.WriteLine(name+".Day="+myDateTime.Day);
Console.WriteLine(name+".Hour="+myDateTime.Hour);
Console.WriteLine(name+".Minute="+myDateTime.Minute);
Console.WriteLine(name+".Second="+myDateTime.Second);
Console.WriteLine(name+".Millisecond="+myDateTime.Millisecond);
Console.WriteLine(name+".Ticks="+myDateTime.Ticks);
}
publicstaticvoidMain()
{
DateTimemyDateTime4=newDateTime(0);
TimeSpanmyTimeSpan=newTimeSpan(4,12,10);
myDateTime4+=myTimeSpan;
DisplayDateTime("myDateTime4",myDateTime4);
}
}開發者ID:C#程序員,項目名稱:System,代碼行數:28,代碼來源:DateTime.Millisecond
注:本文中的System.DateTime.Millisecond屬性示例整理自Github/MSDocs等源碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。
相關方法
DateTime.DateTime()
DateTime.MaxValue
DateTime.MinValue
DateTime.Date
DateTime.Day
DateTime.DayOfWeek
DateTime.DayOfYear
DateTime.Hour
DateTime.Kind
DateTime.Millisecond
DateTime.Minute
DateTime.Month
DateTime.Now
DateTime.Second
DateTime.Ticks
DateTime.TimeOfDay
DateTime.Today
DateTime.UtcNow
DateTime.Year
DateTime.Add()
DateTime.AddDays()
DateTime.AddHours()
DateTime.AddMilliseconds()
DateTime.AddMinutes()
DateTime.AddMonths()
DateTime.AddSeconds()
DateTime.AddYears()
DateTime.Compare()
DateTime.DaysInMonth()
DateTime.Equals()
DateTime.FromBinary()
DateTime.FromFileTime()
DateTime.GetDateTimeFormats()
DateTime.IsDaylightSavingTime()
DateTime.IsLeapYear()
DateTime.Parse()
DateTime.ParseExact()
DateTime.SpecifyKind()
DateTime.Subtract()
DateTime.ToBinary()
DateTime.ToFileTime()
DateTime.ToLocalTime()
DateTime.ToLongDateString()
DateTime.ToLongTimeString()
DateTime.ToShortDateString()
DateTime.ToShortTimeString()
DateTime.ToString()
DateTime.ToUniversalTime()
DateTime.TryParse()
DateTime.TryParseExact()
DateTime.Addition()
DateTime.Equality()
DateTime.Subtraction()
延伸文章資訊
- 1c# - How to format a string as a date with milliseconds - 1400+ ...
DateTime now = DateTime.Now; Label1.Text = "now: " + now.ToString(); //format date time with mill...
- 2C# DateTime Millisecond - Java2s.com
C# Tutorial - C# DateTime Millisecond. ... Description. DateTime Millisecond gets the millisecond...
- 3c# get datetime in milliseconds Code Example
c# get total milliseconds from datetime. csharp by Poor Pollan on Apr 27 2021 Comment ... C# answ...
- 4C# Sharp Exercises: Add one millisecond to a DateTime value
Write C# Sharp Program to add one millisecond and 2.5 milliseconds to a given date value and disp...
- 5How to show time with milliseconds in Excel? - ExtendOffice