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...


In reply to POSIX::strftime modified conversion Specs...can they be used? by snafu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.