c# datetime._C#| DateTime.AddTicks()方法與示例

c# datetime.

DateTime.AddTicks()方法 (DateTime.AddTicks() Method)

DateTime.AddTicks() method is used to return a new date-time object that adds ticks value of this instance. This object does not change the original value of date-time but it returns an object with the new value.

DateTime.AddTicks()方法用于返回一個新的日期時間對象,該對象添加此實例的刻度值。 該對象不會更改日期時間的原始值,但會返回具有新值的對象。

Syntax:

句法:

    DateTime DateTime.AddTicks(long value);

Parameter(s):

參數:

  • long value – represents a long value to be added in the DateTime object.

    long value –表示要添加到DateTime對象中的long值。

Return value:

返回值:

The return type of this method is DateTime, it returns the new value of DateTime object.

此方法的返回類型為DateTime ,它返回DateTime對象的新值。

Example to demonstrate example of DateTime.AddTicks() method

示例,以演示DateTime.AddTicks()方法的示例

using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//Create object of datetime class
DateTime dt1 = new DateTime(2019,1,1,5,0,15);
//Adding 5000 ticks using AddTicks method
DateTime dt2 = dt1.AddTicks(5000);
//Display ticks of dt1
Console.WriteLine("Number of ticks in dt1 : " + dt1.Ticks);
//Display ticks of dt2
Console.WriteLine("Number of ticks in dt2 : " + dt2.Ticks);
Console.WriteLine();  
}
}
}

Output

輸出量

Number of ticks in dt1 : 636819156150000000
Number of ticks in dt2 : 636819156150005000

In the above program, we took the dt1 object of the DateTime class and then add ticks using AddTicks() method and assign an object with new values into dt2. Then print ticks values using Ticks property of DateTime class.

在上面的程序中,我們獲取了DateTime類的dt1對象,然后使用AddTicks()方法添加了滴答聲,并將具有新值的對象分配給dt2 。 然后使用DateTime類的Ticks屬性打印刻度值。

翻譯自: https://www.includehelp.com/dot-net/datetime-addticks.aspx

c# datetime.

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/540913.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/540913.shtml
英文地址,請注明出處:http://en.pswp.cn/news/540913.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

12345組成三個不重復數java,求大神幫忙!五子棋!只能識別按順序識別!例如 12345 不能...

該樓層疑似違規已被系統折疊 隱藏此樓查看此樓import java.util.Arrays;import java.util.Scanner;public class Gobang {public static void main(String[] args) {Scanner sc new Scanner(System.in);boolean finish false;// 有戲是否結束int flagNum 1;// 當前下棋者標記…

[轉]Visual Studio 各版本下載

原文地址:[置頂] Visual Studio 各版本下載 文件名稱文件大小百度網盤下載微軟官方下載Visual Studio 2015 Enterprise - 企業版 - 簡體中文3.89GBhttp://pan.baidu.com/s/1bnAY68Bvs2015.ent_chs.isoVisual Studio 2015 Professional - 專業版 - 簡體中文3.84GBht…

JavaScript中的“ this”關鍵字

JavaScriptthis關鍵字 (JavaScript this keyword) The this keyword is widely used in JavaScript. It has many use cases and is also one of the most intimidating features of JavaScript. In most of the programming languages, this is used to refer to the current …

oracle 列級外鍵,Oracle外鍵列上是否需要索引?

外鍵列上缺少索引會帶來兩個問題,限制并發性、影響性能。而這兩個問題中的任意一個都可能會造成嚴重性能問題。 無論是Or外鍵列上缺少索引會帶來兩個問題,限制并發性、影響性能。而這兩個問題中的任意一個都可能會造成嚴重性能問題。無論是Oracle的官方文…

python 改變詞典順序_按詞典順序排列的功率集

python 改變詞典順序Description: 描述: This is a standard interview problem to find out the power sets in lexicographic order of a given set of numbers using backtracking. 這是一個標準的面試問題,它使用回溯來按給定數字集的字典順序查找能…

oracle創建用戶名了,oracle創建用戶名

創建用戶//創建用戶名create user username identified by password‘’//賦權限Grant Connect,Resource,DBA to UserName;plsql developer配置下載地址http://ah1.down.chinaz.com/201011/plsql8.04cn.zip右擊"我的電腦" - "屬性" - "高級" - &…

webpack學習筆記1

webpack學習筆記1:基本概念 前言: 現在在日常的開發中,webpack已經是必不可少的東西了,現在的需求基本都是用webpack對資源進行打包整合,所以打算寫一點關于webpack的東西,這是第一篇,主要是介紹…

ruby 嵌套函數_Ruby嵌套有示例的循環

ruby 嵌套函數嵌套循環 (Nested for loop) Nesting of for loop means one for loop is available inside another for loop. It means that there are two loops, then the first one is an outer loop and the second one is the inner loop. Execution will take place in t…

oracle10數據庫鏈接失敗,Oracle10g出現Enterprise Manager 無法連接到數據庫實例解決辦法...

剛裝好 10g 時,把的監聽端口是1521.后來把端口改成了1568了,登上em發現Enterprise Manager 無法連接到數據庫實例 ,連接字符串的端口仍是1521,如何解決這個問題。登陸:出現下面錯誤:Enterprise …

springJdbc in 查詢,Spring namedParameterJdbcTemplate in查詢

springJdbc in 查詢,Spring namedParameterJdbcTemplate in查詢, SpringJdbc命名參數in查詢,namedParameterJdbcTemplate in查詢 >>>>>>>>>>>>>>>>>>>>>>>>>>…

oracle 11g r2版本號,Oracle 11g r2新增版本功能(二)

在11.2中,Oracle數據庫引入的版本的概念,這為應用程序的升級提供了極大的方便。這篇簡單描述版本的實現和查詢方式。前一篇簡單描述了版本,下面接著上面的例子看看Oracle是如何實現這個功能的:SQL> select synonym_name, table…

python 添加圖例_Python | 在圖例標簽中添加Sigma

python 添加圖例Sigma (𝜎) is very often used greek mathematical letters and has a higher repetition in probability. In this article, we are going to add 𝜎 using a command in matplotlib. Sigma(𝜎)是希臘數學字母中經常使用的字…

【51CTO學院】搜索V2.0——新的搜索,只為給你更好的

為了讓你能快速、準確的找到自己心儀的內容,51CTO學院產品及研發用盡了洪荒之力研發近2個月終于將搜索進行了全面升級。 搜索看似簡單,實則要做到精準和智能卻不是件易事,為了讓學員快速找到自己所需,節省找課時間,更高…

oracle擴容日志文件,ORACLE 加大日志文件

--新建臨時日志文件alter database add logfile group 4 (‘/u01/app/oracle/oradata/orcl/redo04.log‘) size 10m;alter database add logfile group 5 (‘/u01/app/oracle/oradata/orcl/redo05.log‘) size 10m;alter database add logfile group 6 (‘/u01/app/oracle/orad…

java多線程總結(二)

線程一般有6個狀態: 新建狀態:NEW 可運行狀態:RUNNABLE 休眠狀態:TIMED_WAITING 等待狀態:WAITING 阻塞狀態:BLOCKED 終止狀態“TERMINATED 當我們使用new創建線程之后,線程處于新建狀態,當調用…

scandir函數_PHP scandir()函數與示例

scandir函數PHP scandir()函數 (PHP scandir() function) The full form of scandir is "Scan Directory", the function scandir() is used to get the list of the files and directories available in the specified directory. scandir的完整格式為“ Scan Direc…

韓順平.2011最新版.玩轉oracle視頻教程筆記,韓順平.2011最新版.玩轉oracle視頻教程(筆記)...

韓順平.2011最新版.玩轉oracle視頻教程ORA-01045: user XIAOMING lacks CREATE SESSION privilege; logon denied 警告: 您不再連接到 ORACLE。 SQL> show user; USER 為 ""SQL> conn system/p; 已連接。SQL> grant connect to xiaoming; 授權成功。SQL>…

方冪序列 c+~+_C ++編程中的Trigraph序列

方冪序列 c~Trigraph Sequences in C are the set of three characters starting from double question marks (??). These set of the characters replaces by a single character specified in the below table, C 中的Trigraph序列是從雙問號( ?? )開始的三個…

oracle sysauth,sysauth$基表的用戶權限的一點分析

select privilege#,level from sysauth$ connect by grantee#prior privilege# and privilege#>0 start with grantee#:1 and privilege#>0如上的sql語句頻繁執行,其實對于遞歸sql對于自己初始oracle才一年的菜鳥一般是略去不看的,eygle前輩們有時…

ansys 內聚力_內聚力 軟件工程

ansys 內聚力凝聚 (Cohesion) In general terms, the word cohesion means the action or act of forming a united whole. According to the definition of Cambridge University, cohesion is defined as "the state of sticking together, or being in close agreement…