-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/EPPlus/FormulaParsing/Excel/Functions/DateTime/Days.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/************************************************************************************************* | ||
Required Notice: Copyright (C) EPPlus Software AB. | ||
This software is licensed under PolyForm Noncommercial License 1.0.0 | ||
and may only be used for noncommercial purposes | ||
https://polyformproject.org/licenses/noncommercial/1.0.0/ | ||
A commercial license to use this software can be purchased at https://epplussoftware.com | ||
************************************************************************************************* | ||
Date Author Change | ||
************************************************************************************************* | ||
01/27/2020 EPPlus Software AB Initial release EPPlus 5 | ||
*************************************************************************************************/ | ||
using OfficeOpenXml.FormulaParsing.ExpressionGraph; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime | ||
{ | ||
public class Days : ExcelFunction | ||
{ | ||
public override CompileResult Execute(IEnumerable<FunctionArgument> arguments, ParsingContext context) | ||
{ | ||
ValidateArguments(arguments, 2); | ||
ValidateArguments(arguments, 2); | ||
var numDate1 = ArgToDecimal(arguments, 0); | ||
var numDate2 = ArgToDecimal(arguments, 1); | ||
var endDate = System.DateTime.FromOADate(numDate1); | ||
var startDate = System.DateTime.FromOADate(numDate2); | ||
return CreateResult(endDate.Subtract(startDate).TotalDays, DataType.Date); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters