• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.DateTime类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.DateTime的典型用法代码示例。如果您正苦于以下问题:C# System.DateTime类的具体用法?C# System.DateTime怎么用?C# System.DateTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



System.DateTime类属于命名空间,在下文中一共展示了System.DateTime类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: init

        public static void init()
        {
            reqIndex = 1;

              unixEpoch = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);

              string bundle = DeviceInfo.bundleID();
              string deviceId = DeviceInfo.deviceID();
              string hashSrc;

              if(bundle.Length > 0 && deviceId.Length > 0) {
            reqIdBase = "a-";
            hashSrc = bundle + "-" + deviceId;
              } else {
            System.Random rng = new System.Random();
            reqIdBase = "b-";
            hashSrc = (int)((System.DateTime.UtcNow - unixEpoch).TotalMilliseconds) + "-" + rng.Next();
              }

              byte[] srcBytes = System.Text.Encoding.UTF8.GetBytes(hashSrc);

              System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
              byte[] destBytes = md5.ComputeHash(srcBytes);

              string finalHash = System.BitConverter.ToString(destBytes).Replace("-", string.Empty);

              reqIdBase += finalHash + "-";
        }
开发者ID:Katry4,项目名称:Bloob-bloob,代码行数:28,代码来源:Event.cs


示例2: DateTime

 public DateTime(System.DateTime i)
 {
     if (i != null)
         datetime = i;
     else
         datetime = new System.DateTime();
 }
开发者ID:AntoineOctarina,项目名称:scorm4unity,代码行数:7,代码来源:Scorm1.2_date_time.cs


示例3: IndexedObject

		public IndexedObject(string name, int duration, System.DateTime creation) : base(
			)
		{
			this.name = name;
			this.duration = duration;
			this.creation = creation;
		}
开发者ID:ekicyou,项目名称:pasta,代码行数:7,代码来源:IndexedObject.cs


示例4: MandateRelatedInformation6

 public MandateRelatedInformation6(
     string mandateIdentification,
     System.DateTime dateOfSignature,
     bool dateOfSignatureSpecified,
     bool amendmentIndicator,
     bool amendmentIndicatorSpecified,
     AmendmentInformationDetails6 amendmentInformationDetails,
     string electronicSignature,
     System.DateTime firstCollectionDate,
     bool firstCollectionDateSpecified,
     System.DateTime finalCollectionDate,
     bool finalCollectionDateSpecified,
     Frequency1Code frequency,
     bool frequencySpecified)
 {
     this.mndtIdField = mandateIdentification;
     this.dtOfSgntrField = dateOfSignature;
     this.dtOfSgntrFieldSpecified = dateOfSignatureSpecified;
     this.amdmntIndField = amendmentIndicator;
     this.amdmntIndFieldSpecified = amendmentIndicatorSpecified;
     this.amdmntInfDtlsField = amendmentInformationDetails;
     this.elctrncSgntrField = electronicSignature;
     this.frstColltnDtField = firstCollectionDate;
     this.frstColltnDtFieldSpecified = firstCollectionDateSpecified;
     this.fnlColltnDtField = finalCollectionDate;
     this.fnlColltnDtFieldSpecified = finalCollectionDateSpecified;
     this.frqcyField = frequency;
     this.frqcyFieldSpecified = frequencySpecified;
 }
开发者ID:kikogomez,项目名称:RCNGCMembersManagement,代码行数:29,代码来源:MandateRelatedInformation6.cs


示例5: ToJavaTimeFromDateTime

		public static long ToJavaTimeFromDateTime(this System.DateTime _dateTime)
		{
			System.DateTime _startDate 		= new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
			long 			_timeInMillis 	= (long)(_dateTime.ToUniversalTime().Subtract(_startDate)).TotalMilliseconds;			

			return _timeInMillis;
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:7,代码来源:DateTimeExtensions.cs


示例6: TaxInformation3

 public TaxInformation3(
     TaxParty1 creditor,
     TaxParty2 debtor,
     string administrationZone,
     string referenceNumber,
     string method,
     ActiveOrHistoricCurrencyAndAmount totalTaxableBaseAmount,
     ActiveOrHistoricCurrencyAndAmount totalTaxAmount,
     System.DateTime date,
     bool dateSepecified,
     decimal sequenceNumber,
     bool sequenceNumberSpecified,
     TaxRecord1[] record)
 {
     this.cdtrField = creditor;
     this.dbtrField = debtor;
     this.admstnZnField = administrationZone;
     this.refNbField = referenceNumber;
     this.mtdField = method;
     this.ttlTaxblBaseAmtField = totalTaxableBaseAmount;
     this.ttlTaxAmtField = totalTaxAmount;
     this.dtField = date;
     this.dtFieldSpecified = dateSepecified;
     this.seqNbField = sequenceNumber;
     this.seqNbFieldSpecified = sequenceNumberSpecified;
     this.rcrdField = (TaxRecord1[])record.Clone(); ;
 }
开发者ID:kikogomez,项目名称:RCNGCMembersManagement,代码行数:27,代码来源:TaxInformation3.cs


示例7: Goods

	public Goods(string name, string providerName, System.DateTime receiving, System.DateTime expiring)
	{
		this.name = name;
		this.providerName = providerName;
		this.receievingDate = receiving;
		this.expiringDate = expiring;
	}
开发者ID:Mrak-IW,项目名称:Dot-net-basics,代码行数:7,代码来源:Goods.cs


示例8: Session

 public Session(string sessionId, string login, List<Role> roles, System.DateTime time)
 {
     SessionId = sessionId;
     Login = login;
     Roles = roles;
     Time = time;
 }
开发者ID:bryk,项目名称:csharp-classdiagram-generator,代码行数:7,代码来源:Session.cs


示例9: GenerateIdentity

        public object GenerateIdentity()
        {
            System.DateTime baseDate = new System.DateTime(BASE_YEAR, BASE_MONTH, BASE_DAY);
            System.DateTime now = System.DateTime.Now;

            // Get the days and milliseconds which will be used to build the byte array
            System.TimeSpan days = new System.TimeSpan(now.Ticks - baseDate.Ticks);
            System.TimeSpan msecs = new System.TimeSpan(now.Ticks - (new System.DateTime(now.Year, now.Month, now.Day).Ticks));

            // Convert TimeSpans to a byte array
            byte[] daysArray = System.BitConverter.GetBytes(days.Days);
            byte[] msecsArray = System.BitConverter.GetBytes((long)(msecs.TotalMilliseconds / LIMITING_DIVISOR));

            // Reverse the bytes to match big-endian ordering
            // Used by certain DB engines (i.e. MS-SQL) for indexing
            System.Array.Reverse(daysArray);
            System.Array.Reverse(msecsArray);

            // Generate a real guid for the unique portion of sequential guid and put it in a byte array
            byte[] guidArray = System.Guid.NewGuid().ToByteArray();

            // Copy the bytes into the guid to make the sequential guid
            System.Array.Copy(daysArray, daysArray.Length - 2, guidArray, guidArray.Length - 6, 2);
            System.Array.Copy(msecsArray, msecsArray.Length - 4, guidArray, guidArray.Length - 4, 4);

            return new System.Guid(guidArray);
        }
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:27,代码来源:SequentialGuidIdentityGenerator.cs


示例10: DbgMsg

 //-------------------------------------------------
 public DbgMsg(string tag, string msg, verbosity verbLevel)
 {
     m_tag = tag;
     m_msg = msg;
     m_date = System.DateTime.Now;
     m_lvl  = verbLevel;
 }
开发者ID:gviaud,项目名称:OS-unity-5,代码行数:8,代码来源:DbgMsg.cs


示例11: Player

		public Player(string name, System.DateTime birthDate, NeoDatis.Odb.Test.VO.Sport.Sport
			 favoriteSport)
		{
			this.name = name;
			this.birthDate = birthDate;
			this.favoriteSport = favoriteSport;
		}
开发者ID:ekicyou,项目名称:pasta,代码行数:7,代码来源:Player.cs


示例12: ToDateTimeFromJavaTime

		public static System.DateTime ToDateTimeFromJavaTime(this long _time)
		{
			System.TimeSpan _timeSpanned 	= System.TimeSpan.FromMilliseconds(_time);
			System.DateTime _startDate		= new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
			System.DateTime _dateTime 		= _startDate.Add(_timeSpanned);
			
			return _dateTime;
		}
开发者ID:noahzaozao,项目名称:UnityAdmobAppEventDemo,代码行数:8,代码来源:DateTimeExtensions.cs


示例13: OutputLink

		public OutputLink(long id, System.DateTime date, string url) : base()
		{
			// TODO Auto-generated constructor stub
			// TODO Auto-generated constructor stub
			this.id = id;
			this.date = date;
			this.url = url;
		}
开发者ID:ekicyou,项目名称:pasta,代码行数:8,代码来源:OutputLink.cs


示例14: ObjectWithDates

		public ObjectWithDates(string name, System.DateTime javaUtilDate, System.DateTime
			 javaSqlDte, System.DateTime timestamp) : base()
		{
			this.name = name;
			this.javaUtilDate = javaUtilDate;
			this.javaSqlDte = javaSqlDte;
			this.timestamp = timestamp;
		}
开发者ID:ekicyou,项目名称:pasta,代码行数:8,代码来源:ObjectWithDates.cs


示例15: BinaryConstructorTest1

 public void BinaryConstructorTest1()
 {
     System.DateTime left = new System.DateTime(); // TODO: Initialize to an appropriate value
     BinaryOperators op = new BinaryOperators(); // TODO: Initialize to an appropriate value
     System.DateTime right = new System.DateTime(); // TODO: Initialize to an appropriate value
     jgshort.SqlDom.Expressions.Binary target = new jgshort.SqlDom.Expressions.Binary(left, op, right);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
开发者ID:jgshort,项目名称:SqlDom,代码行数:8,代码来源:BinaryTest.cs


示例16: Game

		public Game(System.DateTime when, NeoDatis.Odb.Test.VO.Sport.Sport sport, NeoDatis.Odb.Test.VO.Sport.Team
			 team1, NeoDatis.Odb.Test.VO.Sport.Team team2)
		{
			this.when = when;
			this.sport = sport;
			this.team1 = team1;
			this.team2 = team2;
		}
开发者ID:ekicyou,项目名称:pasta,代码行数:8,代码来源:Game.cs


示例17: History

		public History(System.DateTime data, NeoDatis.Odb.Test.VO.School.Discipline discipline
			, int score, NeoDatis.Odb.Test.VO.School.Teacher teacher)
		{
			this.date = data;
			this.discipline = discipline;
			this.score = score;
			this.teacher = teacher;
		}
开发者ID:ekicyou,项目名称:pasta,代码行数:8,代码来源:History.cs


示例18: DateTimeTest

 public void DateTimeTest()
 {
     System.DateTime d = new System.DateTime(); // TODO: Initialize to an appropriate value
     ConstantTypes.DateTime expected = null; // TODO: Initialize to an appropriate value
     ConstantTypes.DateTime actual;
     actual = Sql.DateTime(d);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
开发者ID:jgshort,项目名称:SqlDom,代码行数:9,代码来源:SqlTest.cs


示例19: GotFill

 /// <summary>
 /// pass fills through here
 /// </summary>
 /// <param name="t"></param>
 public void GotFill(Trade t)
 {
     if (SendLatency == null) return;
     // see if we know this message
     long start = 0;
     if (!_otime.TryGetValue(t.id, out start)) return;
     double lat = new System.DateTime(gettime()).Subtract(new System.DateTime(start)).TotalMilliseconds;
     report(MessageTypes.EXECUTENOTIFY, t.id, lat);
 }
开发者ID:bluejack2000,项目名称:core,代码行数:13,代码来源:LatencyTracker.cs


示例20: CarRent

 public CarRent()
 {
     InitializeComponent();
     service = new CarService();
     _DateOfBegin = dateTimePicker1.Value;
     _DateOfEnd = dateTimePicker2.Value;
     dateTimePicker1.MinDate = System.DateTime.Today;
     dateTimePicker2.MinDate = System.DateTime.Today;
 }
开发者ID:valdman,项目名称:Lesson2,代码行数:9,代码来源:CarRent.cs



注:本文中的System.DateTime类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.Diagnostics类代码示例发布时间:2022-05-24
下一篇:
C# SqlClient.SqlParameter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap