in reply to Re: Local Date Format
in thread Local Date Format

Sorry if this is causing confusion, I guess I wasn't too clear in my request.

I'm curious to know if it is possible to detect the OS's (either window, unix, etc.) current date format (From region to region these settings will change) and apply that format to display within my scripts.

I hope this is clear, thanks!

Replies are listed 'Best First'.
Re^3: Local Date Format
by chanio (Priest) on Feb 23, 2005 at 00:51 UTC
    This oneliner might help you find what you need... Just try it!

    perl -e "use POSIX qw(strftime setlocale LC_ALL LC_CTYPE);my ($os)=str +ftime(\"%a [%c]\", localtime); my ($loc) = POSIX::setlocale( &POSIX:: +LC_ALL,'en' ); my ($en)= strftime(\"%a [%c]\", localtime);print \"$os + \n$en\n\";" Mar [22/02/2005 21:41:46] Tue [2/22/2005 9:41:46 PM]

    %c prints the default date accepted by the local OS. Or by the LC_ALL requested. (like in 'C' programing, I have heard. So this is obvious for those programers.)