Free cookie consent management tool by TermsFeed Policy Generator

source: branches/RemoveBackwardsCompatibility/HeuristicLab.ExtLibs/HeuristicLab.EPPlus/4.0.3/EPPlus-4.0.3/FormulaParsing/Excel/Functions/DateTime/DateParsingFunction.cs

Last change on this file was 12074, checked in by sraggl, 9 years ago

#2341: Added EPPlus-4.0.3 to ExtLibs

File size: 803 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Globalization;
4using System.Linq;
5using System.Text;
6
7namespace OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime
8{
9    public abstract class DateParsingFunction : ExcelFunction
10    {
11        protected System.DateTime ParseDate(IEnumerable<FunctionArgument> arguments, object dateObj)
12        {
13            System.DateTime date = System.DateTime.MinValue;
14            if (dateObj is string)
15            {
16                date = System.DateTime.Parse(dateObj.ToString(), CultureInfo.InvariantCulture);
17            }
18            else
19            {
20                var d = ArgToDecimal(arguments, 0);
21                date = System.DateTime.FromOADate(d);
22            }
23            return date;
24        }
25    }
26}
Note: See TracBrowser for help on using the repository browser.