Cicode Programming Reference > Cicode Function Categories > Timestamp Functions > TimestampGetPart

TimestampGetPart

Returns one part (year, month, day, etc) of the TIMESTAMP variable.

Syntax

TimestampGetPart(TIMESTAMP Timestamp, INT Part [, INT bUtc])

Timestamp:

The timestamp from which the part will be extracted.

Part:

Indicates which part to extract:

0 – The year part

1 – The month part.

2 – The day part.

3 – The hour part.

4 – The minute part.

5 – The second part.

6 – The millisecond part.

7 - The number of milliseconds since midnight last occurred.

UTC:

Coordinated Universal Time (optional):

0 – The given time INTEGER is a local date/time.(default).

1 – The given time INTEGER is a UTC date/time.

Return Value

The required part of the TIMESTAMP variable.

Related Functions

TimestampAdd, TimestampCurrent, TimestampDifference, TimestampSub, TimestampToStr, TimestampCreate, TimestampFormat, TimestampToTimeInt, TimeIntToTimestamp

Example

TIMESTAMP t1;
	// insert code here
INT year = TimestampGetPart(t1, 0);
INT second = TimestampGetPart(t1, 5);

See Also

Timestamp Functions

 

Published June 2018