NinjaScript > Language Reference > Data >

ToDay()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
Calculates an integer value representing day. NinjaScript uses the .NET DateTime structures which can be complicated for novice programmers. If you are familiar with C# you can directly use DateTime structure properties and methods for date and time comparisons otherwise use this method and the ToTime() method.

 

Integer representation of day is in the following format yyyyMMdd where January 8, 2007 would be 20070108.
 

Method Return Value

An int value that represents the date.

 

Syntax
ToDay(DateTime time)

 

Parameters

time

A DateTime structure such as Time[0] - See Time property

 

 

Examples

// Compare the date of the current bar to September 15, 2008
if (ToDay(Time[0]) > 20080915)
    // Do something