How to touch a file 30min ago

I know how to touch like this

touch -t 199908031046 /tmp/file1

But I want to create a cron job for touch a file which 30 min ago in Solaris which haven't -mmin

Can I use like this ? touch -t `date +%s` - 30 /tmp/file1

Because I want to file the file which older than 30min.

Thanks,

Got perl?

#!/usr/bin/ksh
#----subtract 30 minutes (1800 seconds) from time
STAMP=$(perl -e '($ss, $mm, $hh, $DD, $MM, $YY) = localtime(time() - 1800);
printf "%04d%02d%02d%02d%02d", $YY + 1900, $MM + 1, $DD, $hh, $mm')

#----create an empty file with a timestamp of 30 minutes ago
touch -t $STAMP /tmp/flagfile

#----find older files
find /start/dir -type f ! -newer /tmp/flagfile -print |\
while read FILE
do
  : something with $FILE
done

You can use Tcl to achieve that

touch -t `echo 'puts [clock format [expr [clock seconds]-30*60] -format "%Y%m%d%H%M.%S"]' | tclsh` file.30min.old

tclsh is normally available in Linux
In Solaris 9 or 10, it is likely found in
/usr/sfw/bin/tclsh8.3 or
/opt/sfw/bin/tclsh8.3

I try this script but still doesn't work

#!/usr/bin/ksh

the_hour=`date +"%H"`
the_min=`date +"%M"`
# calc_time=`expr $the_hour - 3`
calc_time=`expr $the_min - 30`
echo "The current time is $the_hour:$the_min"
# echo "This is the calculated time $calc_time:$the_min"
echo "This is the calculated time $the_hour:$calc_time"

sh -x test.sh
+ date +%H
the_hour=15
+ date +%M
the_min=43
+ expr 43 - 30
calc_time=13
+ echo The current time is 15:43
The current time is 15:43
+ echo This is the calculated time 15:13
This is the calculated time 15:13

but looks this script cannot run before every 29min or lower.

ksh: tclsh: not found

> cd /usr/sfw
ksh: /usr/sfw: not found
> cd /opt/sfw
ksh: /opt/sfw: not found

> sh -x test5.sh
test5.sh: syntax error at line 3: `STAMP=$' unexpected

I think I got the perl but dont know whats happen.

You are feeding a korn shell script into a bourne shell. That won't work. You should do:
chmod u+x test5.sh
./test5.sh