Skip to main content

Trunc(Object) Method

Truncates the specified numeric or timestamp to the next lower integer or second, respectively.

Definition​

Namespace: GHost.GSharp.Analytics.AF
Assembly: GHost.GSharp.Analytics.AF (in GHost.GSharp.Analytics.AF.dll) Version: 1.2.0.0 (1.2.44.3)

C#

public static Object Trunc(
Object value
)

VB

Public Shared Function Trunc ( 
value As Object
) As Object

Parameters​

  Object
Numeric or timestamp value that needs to be truncated.

Return Value​

Object
Possible return values are:

  • Value of type Double truncated to next lower integer for numeric value.
  • Value of type DateTime truncated to next lower second for timestamp value.

Remarks​

Throws an exception if value is an invalid time string.

Example​

C#

double dblResult;
DateTime dtResult;
dblResult = Trunc(22.5); //Returns 22
dtResult = Trunc(DateTime.Today.AddSeconds(0.5)); //Returns DateTime.Today

Exceptions​

ArgumentException

See Also​

Reference​

FunctionLibrary Class
Trunc Overload
GHost.GSharp.Analytics.AF Namespace