public function execute(TstampTask $tstamp, $d, $location)
    {
        if (empty($this->propertyName)) {
            throw new BuildException("property attribute must be provided", $location);
        }

        if (empty($this->pattern)) {
            throw new BuildException("pattern attribute must be provided", $location);
        }

        $oldlocale = "";
        if (!empty($this->locale)) {
            $oldlocale = setlocale(LC_ALL, 0);
            setlocale(LC_ALL, $this->locale);
        }

        $savedTimezone = date_default_timezone_get();
        if (!empty($this->timezone)) {
            date_default_timezone_set($this->timezone);
        }

        $value = strftime($this->pattern, $d);
        $tstamp->prefixProperty($this->propertyName, $value);

        if (!empty($this->locale)) {
            // reset locale
            setlocale(LC_ALL, $oldlocale);
        }

        if (!empty($this->timezone)) {
            date_default_timezone_set($savedTimezone);
        }
    }