Timestamp

Method: static Timestamp Parse(String)

The method that converts the value in the string type and yyyyMMddHHmmssfff format to the type Timestamp

    Timestamp.Parse("20170810114637123"); //10.08.2017 11:46:37.123
Parameter Name Description
timestampString Value in string type and in the format yyyyMMddHHmmssfff.

Constructor(DateTime)

A TimeStamp object is created with a value of type DateTime.

    new Timestamp(new DateTime(2014, 4, 13)); //13.04.2014 00:00:00.000
Parameter Name Description
dateTime A time value in DateTime type.

Property: DateTime Value

The date and time value in the DateTime type of the value.


Method: DateTime AddDays(Int32)

Adds days to the Timestamp Data.

    new Timestamp(new DateTime(2017,8,7)).AddDays(3); // 8/10/2017 00:00:00.000
Parameter Name Description
days Days information in int type

Method: DateTime AddMonths(Int32)

Adds months to the Timestamp Data.

    new Timestamp(new DateTime(2017,8,7)).AddMonths(1); // 9/7/2017 00:00:00.000
Parameter Name Description
months Months information in int type

Method: DateTime AddYears(Int32)

Adds years to the Timestamp Data.

    new Timestamp(new DateTime(2017,8,7)).AddYears(1); // 8/7/2018 00:00:00.000
Parameter Name Description
years Years information in int type

Method: DateTime AddHours(Int32)

Adds hours to the Timestamp Data.

    new Timestamp(new DateTime(2017,8,7)).AddHours(1); // 8/7/2017 01:00:00.000
Parameter Name Description
hours Hours information in int type

Method: DateTime AddMinutes(Int32)

Adds minutes to the Timestamp Data.

    new Timestamp(new DateTime(2017,8,7)).AddMinutes(1); // 8/7/2017 00:01:00.000
Parameter Name Description
minutes Minutes information in int type

Method: DateTime AddSeconds(Int32)

Adds seconds to the Timestamp Data.

    new Timestamp(new DateTime(2017,8,7)).AddSeconds(1); // 8/7/2017 00:00:01.000
Parameter Name Description
seconds Seconds information in int type

Method: DateTime AddMilliseconds(Int32)

Adds milliseconds to the Timestamp Data.

    new Timestamp(new DateTime(2017,8,7)).AddMilliseconds(1); // 8/7/2017 00:00:00.001
Parameter Name Description
milliseconds Milliseconds information in int type

Method: Date ToDate()

Returns the data by converting it to Date type.


Method: DateTime ToDateTime()

Returns the data by converting it to DateTime type.


Property: int Hour

Returns the hour value of the given int type.

    new Timestamp(new DateTime(2017,8,7,10,0,0)).Hour; // 10

Property: int Minute

Returns the minute value of the given int type.

    new Timestamp(new DateTime(2017,8,7,0,7,0)).Minute; // 7

Property: int Second

Returns the second value of the given int type.

    new Timestamp(new DateTime(2017,8,7,0,0,45)).Second; // 45

Property: int Millisecond

Returns the millisecond value of the given int type.

    new Timestamp(new DateTime(2017,8,7,0,0,0).AddMilliseconds(761)).Millisecond; // 761

Property: int Day

Returns the day value of the given int type.

    new Timestamp(new DateTime(2017,8,7)).Day; // 7

Property: DayOfWeek DayOfWeek

Returns the DayOfWeek type which is the day of the week.

    new Timestamp(new DateTime(2017,8,7)).DayOfWeek; // Monday

Property: int DayOfYear

Returns the int type which is the day of the year.

    new Timestamp(new DateTime(2017,8,7)).DayOfYear; // 219

Property: int Month

Returns the int type which is the month of the year.

    new Timestamp(new DateTime(2017,8,7)).Month; // 8

Property: int Year

Returns year value as int type

    new Timestamp(new DateTime(2017,8,7)).Year; // 2017

Method: string ToString()

The Timestamp value is returned in string type and in the yyyyMMddHHmmssfff format .


Method: int CompareTo(Object)

The data is compared with the given object.

The given object must be an object of type Timestamp.

Returns -1 if the data is less than the given object, 0 if it is equal, and 1 if it is greater than the given object.

    new Timestamp(new DateTime(2014, 4, 13)).CompareTo(new Timestamp(new DateTime(2014, 4, 14))) < 0; //true
    new Timestamp(new DateTime(2014, 4, 14)).CompareTo(new Timestamp(new DateTime(2014, 4, 14))) == 0;  //true
    new Timestamp(new DateTime(2014, 4, 14)).CompareTo(new Timestamp(new DateTime(2014, 4, 13))) > 0; //true

    new Timestamp(new DateTime(2014, 4, 13)).CompareTo(new Timestamp(new DateTime(2014, 4, 14))) >= 0; //false
    new Timestamp(new DateTime(2014, 4, 14)).CompareTo(new Timestamp(new DateTime(2014, 4, 14))) != 0; //false
    new Timestamp(new DateTime(2014, 4, 14)).CompareTo(new Timestamp(new DateTime(2014, 4, 13))) <= 0; //false
Parameter Name Description
obj Object to be compared

Error Type: ArgumentException (This error is thrown if the given object is not a Date object.)


Method: int CompareTo(Timestamp)

The data is compared with the given object. Returns a number less than 0 if the data is less than the given object.

Returns 0 if the data is equal to the given object.

Returns a number greater than 0 if the data is greater than the given object.

    new Timestamp(new DateTime(2014, 4, 13)).CompareTo(new Timestamp(new DateTime(2014, 4, 14))) < 0; //true
    new Timestamp(new DateTime(2014, 4, 14)).CompareTo(new Timestamp(new DateTime(2014, 4, 14))) == 0;  //true
    new Timestamp(new DateTime(2014, 4, 14)).CompareTo(new Timestamp(new DateTime(2014, 4, 13))) > 0; //true

    new Timestamp(new DateTime(2014, 4, 13)).CompareTo(new Timestamp(new DateTime(2014, 4, 14))) >= 0; //false
    new Timestamp(new DateTime(2014, 4, 14)).CompareTo(new Timestamp(new DateTime(2014, 4, 14))) != 0; //false
    new Timestamp(new DateTime(2014, 4, 14)).CompareTo(new Timestamp(new DateTime(2014, 4, 13))) <= 0; //false
Parameter Name Description
other The object to be compared in the Timestamp type

Method: bool Equals(Object)

Returns true if the given object has the same value as the Timestamp object and the data, false otherwise.

Parameter Name Description
obj Object to be compared

Method: bool Equals(Timestamp)

Returns true if the given Timestamp object has the same value as the data, false otherwise.

Parameter Name Description
other The object of type Timestamp to be compared

Extension Method: Timestamp ToTimestamp(DateTime)

The method that converts the date and time data in the DateTime type to the Timestamp type.

    new DateTime(2014, 4, 5).ToTimestamp() == new Timestamp(new DateTime(2014, 4, 5)); //true
Parameter Name Description
source Date and time data in the DateTime type