ToMillisecondsSinceEpoch() public static méthode

Converts a DateTime to number of milliseconds since Unix epoch.
public static ToMillisecondsSinceEpoch ( System.DateTime dateTime ) : long
dateTime System.DateTime A DateTime.
Résultat long
Exemple #1
0
        private DateTime value; // only valid if millisecondsSinceEpoch is between MinValue and MaxValue for DateTime
        #endregion

        #region constructors
        /// <summary>
        /// Initializes a new instance of the BsonDateTime class.
        /// </summary>
        /// <param name="value">A DateTime.</param>
        public BsonDateTime(
            DateTime value
            )
            : base(BsonType.DateTime)
        {
            this.millisecondsSinceEpoch = BsonUtils.ToMillisecondsSinceEpoch(value);
            this.value = value;
        }
Exemple #2
0
 // constructors
 /// <summary>
 /// Initializes a new instance of the BsonDateTime class.
 /// </summary>
 /// <param name="value">A DateTime.</param>
 public BsonDateTime(DateTime value)
 {
     _millisecondsSinceEpoch = BsonUtils.ToMillisecondsSinceEpoch(value);
 }