[ moving to datetime list, since perl-date-time-dev is just me and a few others ]
On Tue, 18 Mar 2003, Teun van Eijsden wrote: > You are all doing a fine job in creating a consistent perl dattime > module. I have one comment though. This: > > $ymd = $dt->ymd > $mdy = $dt->mdy > $dmy = $dt->dmy > > is very ugly to me. I can imagine an application where the user can > select his favorite date format, say 'ymd'. The application should then > have some if/elsif/else structure to select the appropriate method. > > Perhaps this would be more elegant: > > my $prettyPrintedDate = $dt->date(format => 'ymd', separator => '-'); > > Where the format could be ymd, mdy or dmy. You can do this: my $format = $user->date_format; $dt->$format(); Also, you could store the user's preference as strftime format and do: $dt->strftime( $user->date_format ); -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/
