Following changes to lib/TWiki/attach.pm allows time/date processing:

Add after
use strict; 
use Assert; 
use TWiki::Time; 

and add before
    # I18N: Site specified %ATTACHEDIMAGEFORMAT% or %ATTACHEDFILELINKFORMAT%,
    # ensure that filename is URL encoded - first $name must be URL.
    $fileLink =~ s/\$name/$fileURL/;
    $fileLink =~ s/\$name/$attName/;
    my $fileext = $attName;
    $fileext =~ s/(.*\.)*([^.]*)/$2/;
    $fileLink =~ s/\$fileext/$fileext/;

    if (defined $att->{date})
    {
      my $date = $att->{date};
      use Time::localtime;
      my ($seconds,$minutes,$hours,$day,$mo,$ye,$wday,$ydat,$isdst) = gmtime($date);
      #require TWiki::time;
      $fileLink =~ s/\$date/TWiki::Time::formatTime( $date || 0)/gei;
      $fileLink =~ s/\$seconds/TWiki::Time::formatTime( $date || 0, "\$seconds")/gei;
      $fileLink =~ s/\$minutes/TWiki::Time::formatTime( $date || 0, "\$minutes")/gei;
      $fileLink =~ s/\$hours/TWiki::Time::formatTime( $date || 0, "\$hours")/gei;
      $fileLink =~ s/\$wday/TWiki::Time::formatTime( $date || 0, "\$wday")/gei;
      $fileLink =~ s/\$day/TWiki::Time::formatTime( $date || 0, "\$day")/gei;
      $fileLink =~ s/\$month/TWiki::Time::formatTime( $date || 0, "\$month")/gei;
      $fileLink =~ s/\$mo/TWiki::Time::formatTime( $date || 0, "\$mo")/gei;
      $fileLink =~ s/\$year/TWiki::Time::formatTime( $date || 0, "\$year")/gei;
      $fileLink =~ s/\$ye/TWiki::Time::formatTime( $date || 0, "\$ye")/gei;
    }


After this change, following attachment example is possible:
On TWIki Site:
   * Local ATTACHEDFILELINKFORMAT = |$year-$mo-$day|Effort        |[[%ATTACHURL%/$name][%ICON{$fileext}% $name]]| received from company xy |


Simple enhancement with nice effects, good enough to add to the next twiki version?

-- TWiki:Main/SaschaVetter - 18 Aug 2008

Sascha, I just discovered this because it was waiting for feedback, but had no-one in the "Waiting For" field. That's a sort of limbo; nothing will happen to reports in that state. I changed it to "New". The code is fine, but this should really have been raised as a feature proposal and we are now in feature-freeze for Foswiki 1.0.0.

I have created AddTimeFeaturesToAttachmentLinks for you.

Going ahead with this, with some changes:

Added unit tests.

-- GeorgeClark - 26 May 2012

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads