Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] New user Account / Quote Number



******    message to minivend-users from Bill Randle <billr@exgate.tek.com>     ******

Cameron Prince wrote:
> 
> ******    message to minivend-users from Cameron Prince <PRINCECB@novachem.com>     ******
> 
> Bill,
> 
> Your usertag worked great for the quote number. I ditched my GlobalSub and
> went with it.
> 
> Would you care to elaborate on the convert-date usertag you mentioned? What
> does it do?
> 
> I need something that will calculate a date 30 days from now and set it as a
> scratch such as 6/21/2000
> 
> Thanks,
> 
> Cameron

Cameron,

Here's the convert-date usertag. I generally use it like:
	[seti expire][convert-date 30][/convert-date][/seti]
or
	[seti expire][convert-date 30 raw][/convert-date][/seti]

to set a date 30 days in the future. The date format is dd-mon-yyyy or
YYYYMMDDHHMM, respectively. You can tweak it to generate mm/dd/yyyy.
Thanks go to Mike for this tag (as well as fcounter).

	-Bill

UserTag convert-date Order days raw
UserTag convert-date PosNumber 2
UserTag convert-date HasEndTag
UserTag convert-date Interpolate
UserTag convert-date Routine <<EOR
sub {
    my ($days, $raw, $text) = @_;
    my @t;

        my $fmt = '%d-%b-%Y';
        if($text =~ /\d/) {
                        $text =~ s/\D//g;
                        $text =~ /(\d\d\d\d)(\d\d)(\d\d)(?:(\d\d)(\d\d))?/;
                        $t[2] = $4 || undef;
                        $t[1] = $5 || undef;
                        $t[3] = $3;
                        $t[4] = $2 - 1;
                        $t[5] = $1;
                        $t[5] -= 1900;
        }
        else {
                        my $now = time();
                        if ($days) {
                                        $now += $days * 86400;
                        }
                        @t = localtime($now);
        }

        if (defined $raw and Vend::Util::is_yes($raw)) {
                        $fmt = $t[2] && $text ?  '%Y%m%d%H%M' : '%Y%m%d';
        }
        elsif ($t[2]) {
                        $fmt = '%d-%b-%Y %I:%M%p';
        }

    return POSIX::strftime($fmt, @t);
}
EOR
-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: