Thanks. This is what I was looking for. I stumbled across it a few times but didn't remember the name when I needed it.
I'm a huge fan of ISO 8601 [1] as it makes the locale problem go away. This would be a good format for Microsoft to adopt as a built-in. [1] https://xkcd.com/1179/ On 13 Nov 2015 2:49 a.m., "Nick Burch" <[email protected]> wrote: > On Thu, 12 Nov 2015, Javen O'Neal wrote: > >> In one POI project I'm working on, I am writing a date to a cell. >> I'm using >> CellStyle datetStyle = workbook.createCellStyle(); >> dateStyle.setDataFormat(22); >> >> Is there a POI constant that I can use instead of the number 22? >> > > org.apache.poi.ss.usermodel.BuiltinFormats ? > > Though it might want extending to expose some of the more common ones in a > more helpful constant-like way... Several of those get "localised" too, > showing up as different things depending on the locale of the Excel program > opening it. eg Format 0xe is defined as m/d/yy, but opening it up on in a > UK-English Excel shows as dd/mm/yyyy > > Maybe we could combine providing more helpful constants with also > capturing the locale-specific localised versions too? (IIRC it's only these > built-in formats that get magically localised like that) > > Nick > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
