C# Class Scriban.Helpers.ScriptDate

Simplified datetime object used for scripting, accessible through the "date" variable (e.g {{date.now}})
Mostra file Open project: lunet-io/scriban Class Usage Examples

Public Methods

Method Description
AddDays ( double days, ScriptDate date ) : ScriptDate

Adds days to date.

AddHours ( double hours, ScriptDate date ) : ScriptDate

Adds hours to date.

AddMilliseconds ( double millis, ScriptDate date ) : ScriptDate

Adds millis to date.

AddMinutes ( double minutes, ScriptDate date ) : ScriptDate

Adds minutes to date.

AddMonths ( int months, ScriptDate date ) : ScriptDate

Adds months to date.

AddSeconds ( double seconds, ScriptDate date ) : ScriptDate

Adds seconds to date.

AddYears ( int years, ScriptDate date ) : ScriptDate

Adds years to date.

CompareTo ( object obj ) : int
Parse ( string text ) : ScriptDate

Parses the specified text as a ScriptDate using the current culture.

ScriptDate ( System.DateTime date ) : System

Initializes a new instance of the ScriptDate struct.

ToString ( ) : string
ToString ( string pattern, ScriptDate date ) : string

Returns a System.String that represents this instance.

Private Methods

Method Description
EvaluateBinaryExpression ( ScriptBinaryExpression expression, ScriptDate left, ScriptDate right ) : object
EvaluateBinaryExpression ( ScriptBinaryExpression expression, ScriptDate left, ScriptTimeSpan right ) : object
IScriptCustomType ( Type destinationType, object &outValue ) : bool
IScriptCustomType ( ScriptBinaryExpression expression, object left, object right ) : object
IScriptCustomType ( ScriptUnaryExpression expression ) : object
Register ( ScriptObject builtins ) : void

Method Details

AddDays() public static method

Adds days to date.
public static AddDays ( double days, ScriptDate date ) : ScriptDate
days double The days.
date ScriptDate The date.
return ScriptDate

AddHours() public static method

Adds hours to date.
public static AddHours ( double hours, ScriptDate date ) : ScriptDate
hours double The hours.
date ScriptDate The date.
return ScriptDate

AddMilliseconds() public static method

Adds millis to date.
public static AddMilliseconds ( double millis, ScriptDate date ) : ScriptDate
millis double The millis.
date ScriptDate The date.
return ScriptDate

AddMinutes() public static method

Adds minutes to date.
public static AddMinutes ( double minutes, ScriptDate date ) : ScriptDate
minutes double The minutes.
date ScriptDate The date.
return ScriptDate

AddMonths() public static method

Adds months to date.
public static AddMonths ( int months, ScriptDate date ) : ScriptDate
months int The months.
date ScriptDate The date.
return ScriptDate

AddSeconds() public static method

Adds seconds to date.
public static AddSeconds ( double seconds, ScriptDate date ) : ScriptDate
seconds double The seconds.
date ScriptDate The date.
return ScriptDate

AddYears() public static method

Adds years to date.
public static AddYears ( int years, ScriptDate date ) : ScriptDate
years int The years.
date ScriptDate The date.
return ScriptDate

CompareTo() public method

public CompareTo ( object obj ) : int
obj object
return int

Parse() public static method

Parses the specified text as a ScriptDate using the current culture.
public static Parse ( string text ) : ScriptDate
text string A text representing a date.
return ScriptDate

ScriptDate() public method

Initializes a new instance of the ScriptDate struct.
public ScriptDate ( System.DateTime date ) : System
date System.DateTime The date.
return System

ToString() public method

public ToString ( ) : string
return string

ToString() public static method

Returns a System.String that represents this instance.
public static ToString ( string pattern, ScriptDate date ) : string
pattern string The date format pattern.
date ScriptDate The date to format.
return string