http://www.perlmonks.org?node_id=191594

snafu has asked for the wisdom of the Perl Monks concerning the following question:

According to the system strftime() (Solaris 6) strftime allows modified conversions to be used over default conversions. According to the man page one would use these modified conversions using %Oformat_string or %Eformat_string to override the defaults.

Such conversions do not seem to work on my Sun system using Perl's POSIX::strftime function *or* the system date. Therefore, I tried it on my FreeBSD box and things are just as up in the air as with the Sun box only the system seems to work properly there (which doesn't surprise me...Sun, grrr)

The POSIX::strftime perldoc is not very helpful in this respect unless I am missing something (which I admit is entirely possible)

As I looked into this on my FreeBSD box I found that the POSIX standard holds true there (makes sense), however, when I attempted to use strftime I got the following (checked out the date command first to make sure the system was properly working)

[notjames@zap ~]$ date +%EG 2002 [notjames@zap ~]$ date +%Eg 02 [notjames@zap ~]$ perl -MPOSIX -e 'print strftime('%Eg',localtime())," +\n"' 43 [notjames@zap ~]$ perl -MPOSIX -e 'print strftime('%Eg',localtime())," +\n";' 58 [notjames@zap ~]$ perl -MPOSIX -e 'print strftime('%Eg',localtime())," +\n";' 0 [notjames@zap ~]$ perl -MPOSIX -e 'print strftime('%Eg',localtime())," +\n";' 2 [notjames@zap ~]$ perl -MPOSIX -e 'print strftime('%Eg',localtime())," +\n";' 4 [notjames@zap ~]$ perl -MPOSIX -e 'print strftime('%g',localtime()),"\ +n";' 9 [notjames@zap ~]$ perl -MPOSIX -e 'print strftime('%G',localtime()),"\ +n";' 16 [notjames@zap ~]$

The Sol box did less! (surprise surprise)...

$ date +%Eg %Eg $ date + %Eg $ date + %C $ date +%C Tue Aug 20 16:46:32 EDT 2002 $ date +%Og %Og $ perl -MPOSIX -e 'print strftime("%Og",localtime()),"\n";' %Og $ perl -MPOSIX -e 'print strftime("%Eg",localtime()),"\n";' %Eg $ perl -MPOSIX -e 'print strftime("%Eg",localtime()),"\n";' %Eg
This very well maybe be a system issue vs a Perl issue. It could be how Perl was built. I'd just like to clarify which it might be. Has anyone else ever run into this?

_ _ _ _ _ _ _ _ _ _
- Jim
Insert clever comment here...