date formatting - Why is this format "[$-F400]h:mm:ss\ AM/PM" a 24 hour format in Excel? -
date formatting - Why is this format "[$-F400]h:mm:ss\ AM/PM" a 24 hour format in Excel? -
and yet 1 [$-409]h:mm:ss\ am/pm;@ not , shows am/pm correctly? 
i'm using npoi read excel file , extract useful info app. while parsing dates, stumbled across interesting case.
this date 16:00:00 (4 o'clock in afternoon) format [$-f400]h:mm:ss\ am/pm showing 16:00:00 in excel. 
yet similar format, [$-409]h:mm:ss\ am/pm;@, shows 04:00:00 pm, believe  right because of am/pm notation @ end of format string.
my excel version one: microsoft® office excel® 2007 (12.0.6665.5003) sp3 mso (12.0.6662.5000)
and i'm using latest version of npoi (got source code), interprets [$-f400]h:mm:ss\ am/pm hh:mm:ss tt (which doesn't match way excel shows it)
i know [$-xxxx] locale, don't know ;@.
why, depending on circunstances, excel ignoring am/pm part?
edit: appears @ text-placeholder am/pm  seems. absence of token forcing excel show 24-hour format?
as @pnuts commented, this link indicates excel uses special sequence scheme default.
"the cause is, excel uses (undocumented) escape sequence "system default". [$-f800] date, long scheme default [$-f400] time, scheme default".
npoi ignores locale information, it's passed parameter dataformatter. so, instead of using  scheme default, parses "am/pm" part , shows 12-hour format, instead of 24-hour  scheme default
i've solved problem changing source code of library suit needs in case.
 excel date-formatting npoi 
 
  
Comments
Post a Comment