当前位置: 首页>>代码示例>>C#>>正文


C# System.DateTime类代码示例

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


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


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