本文整理汇总了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 + "-";
}
示例2: DateTime
public DateTime(System.DateTime i)
{
if (i != null)
datetime = i;
else
datetime = new System.DateTime();
}
示例3: IndexedObject
public IndexedObject(string name, int duration, System.DateTime creation) : base(
)
{
this.name = name;
this.duration = duration;
this.creation = creation;
}
示例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;
}
示例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;
}
示例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(); ;
}
示例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;
}
示例8: Session
public Session(string sessionId, string login, List<Role> roles, System.DateTime time)
{
SessionId = sessionId;
Login = login;
Roles = roles;
Time = time;
}
示例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);
}
示例10: DbgMsg
//-------------------------------------------------
public DbgMsg(string tag, string msg, verbosity verbLevel)
{
m_tag = tag;
m_msg = msg;
m_date = System.DateTime.Now;
m_lvl = verbLevel;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}