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.mzph.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…