c# - how to get the earliest date Excel support programmatically -


excel addin, c#, udf, myudf calls web service retrieve date. date returned not in range of jan-1-1900 dec-31-9999 (excel date range). e.g. in 1 case returned date jan-2-0002 (valid in c# not valid in excel), excel crashes. not hard code "jan-1-1900", wonder if there way can programmatically.

inside excel, convert date corresponding 1 string can parse:

=text(1,"dd-mm-yyyy") 

which should give 01-01-1900 or 02-01-1904 depending on date system chosen (hat tip barrowc!). note how date systems don't differ 4 years fact in 1 case value 1 corresponds january 1st (in 1900) , in other 0 corresponds january 1st (in 1904). given workbook, workbook.date1904 property can tell date system being used.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -