Navigation:  Module 1 - Energy Accounting > Accounts & Invoices Tab > User Defined Components > Object Types > DateRange Object Type >

FractionInPeriod Method

Previous page Next page
  rev. 2011-02-09        

Description:

Gets the fraction of the date range which falls within the specified period, expressed as a value from 0 to 1.o.

Syntax:

[DateRange Object].FractionInPeriod( startMonth, startDay, endMonth, endDay)

The four parameters are integers.  This syntax specifies the month and day, but ignores the year.

[DateRange Object].FractionInPeriod( startDate, endDate)

The two parameters are fully-defined DateTime objects.  This syntax specifies the year as well as the month and day.

Arguments:

Argument

Type

Description

startMonth

Numeric

The start month (1-12)

startDay

Numeric

The start day

endMonth

Numeric

The end month (1-12)

endDay

Numeric

The end day

startDate

DateTime

The start date

endDate

DateTime

The end date

Returns:

The fraction (0 to 1) of the date range which falls within the specified period.

Examples:

Get the fraction of the date range (2009-01-20 to 2009-06-15) which falls within Jan 1 to Feb 1.

Expression

Result

DateRange(Date(2009,1,20), Date(2009,6,15)).FractionInPeriod(1,1,2,1)

0.0821917

DateRange(Date(2009,1,20), Date(2009,6,15)).FractionInPeriod(Date(2009,1,1),Date(2009,2,1))

0.0821917

 



snippet_FractionInPeriod_Method         ©2014 Managing Energy Inc.