Hi folks,

Does anyone know of a way to get strftime (or DateTime) to return the
"appropriate" format for years, regardless whether the locale is in
Common Era or Buddhist Era?

I am able to get the current year B.E. like this:

$ LC_ALL=th_TH perl -MPOSIX=strftime -le 'print
strftime("%Ey",localtime)'
2548

However, if I try to use the %Ey format in a CE locale, I don't get the
"2005" I expected, but "05" instead:

$ LC_ALL=en_US perl -MPOSIX=strftime -le 'print
strftime("%Ey",localtime)'
05

TIA,
Philip
  • Buddhist era dates Garrett, Philip \(MAN-Corporate\)

Reply via email to