<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><DIV>If you can't change the output format in Oracle (preferred option), then you can write a simple date conversion subroutine and pass its reference to the TT2 template (inside the $data data structure). </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Here is a first go at the conversion sub...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><FONT class="Apple-style-span" face="Courier">sub convert_date {</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    #</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    # Convert date from DD-MON-YYYY to YYYY-MM-DD</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    #</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    my ($input_date) = @_;</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    my ($day, $month, $year, $iso_date);</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    if ($input_date !~ /\d{2}\-\w{3}\-\d{4}/) {</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">        return $input_date; # or output error message</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    }</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    my %months = ('JAN' =&gt; '01', 'FEB' =&gt; '02', 'MAR' =&gt; '03'); # etc</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    my @parts  = split(/\-/, $input);</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    $day   = $parts[0];</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    $month = $months{uc($parts[1])};  #  uc() to ensure upper case </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    $year  = $parts[2];</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    $iso_date = "$year-$month-$day";</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">    return $iso_date;</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">}</FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Next add a reference to this sub to the $data hash (might need fixing as I don't know what $data looks like inside).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><FONT class="Apple-style-span" face="Courier">sub processTemplate {</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">  my ($data, $filename) = @_;</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier"><BR></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">  my ($outfile) = $outdir . "/" . $filename . ".xml";</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">  open (my $fh, "&gt; $outfile") or die "Can't open the output file $outfile: $!^?\n";</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">  <BR></FONT></DIV><DIV><SPAN class="Apple-style-span"><FONT class="Apple-style-span" face="Courier">  </FONT><B><FONT class="Apple-style-span" face="Courier">$data-&gt;{"convert_date"} = \&amp;convert_date; # or $data{"convert_date} ...</FONT></B></SPAN></DIV><DIV><FONT class="Apple-style-span" face="Courier">  </FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">  my $config = {  INCLUDE_PATH    =&gt;      $outdir,</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">                  TAG_STYLE       =&gt;      'html',</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">                  PRE_CHOMP       =&gt;      1,</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">               };</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier"><BR></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">  my $tt = Template-&gt;new($config);</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">  my $templatefile = "anztemp.xml";</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier"><BR></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">  $tt-&gt;process("$templatefile", $data, $fh) || die $tt-&gt;error;</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">  close $fh;</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier"><BR></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier">} </FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Then in your template file, replace the date declaration with:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>&lt;!-- convert_date(LASTUPDATE) --&gt;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Hope this helps.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Nick</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>On 06/02/2007, at 1:07 PM, &lt;<A href="mailto:John.Hockaday@ga.gov.au">John.Hockaday@ga.gov.au</A>&gt; &lt;<A href="mailto:John.Hockaday@ga.gov.au">John.Hockaday@ga.gov.au</A>&gt; wrote:</DIV><BLOCKQUOTE type="cite"><DIV>Hi All,</DIV><DIV><BR></DIV><DIV>I have a script that uses the Template PERL module to create an XML document</DIV><DIV>from the hash table pulled out of a RDBMS.  Part of the template processing</DIV><DIV>code is:</DIV><DIV>###########################################</DIV><DIV>sub processTemplate {</DIV><DIV>  my ($data, $filename) = @_;</DIV><DIV><BR></DIV><DIV>  my ($outfile) = $outdir . "/" . $filename . ".xml";</DIV><DIV>  open (my $fh, "&gt; $outfile") or die "Can't open the output file $outfile: $!</DIV><DIV>^?\n";</DIV><DIV><BR></DIV><DIV>  my $config = {  INCLUDE_PATH    =&gt;      $outdir,</DIV><DIV>                  TAG_STYLE       =&gt;      'html',</DIV><DIV>                  PRE_CHOMP       =&gt;      1,</DIV><DIV>               };</DIV><DIV><BR></DIV><DIV>  my $tt = Template-&gt;new($config);</DIV><DIV>  my $templatefile = "anztemp.xml";</DIV><DIV><BR></DIV><DIV>  $tt-&gt;process("$templatefile", $data, $fh) || die $tt-&gt;error;</DIV><DIV>  close $fh;</DIV><DIV><BR></DIV><DIV>} #End processTemplate</DIV><DIV>#########################################</DIV><DIV><BR></DIV><DIV>Part of the template to generate the XML is:</DIV><DIV><BR></DIV><DIV>#########################################</DIV><DIV>  &lt;metainfo&gt;</DIV><DIV>    &lt;metd&gt;</DIV><DIV>      &lt;date&gt;</DIV><DIV>&lt;!-- LASTUPDATE --&gt;</DIV><DIV>      &lt;/date&gt;</DIV><DIV>    &lt;/metd&gt;</DIV><DIV>  &lt;/metainfo&gt;</DIV><DIV>#########################################</DIV><DIV><BR></DIV><DIV>The trouble is that the LASTUPDATE date (Oracle RDBMS) is in the form</DIV><DIV>DD-MON-YYYY  whereas I want ISO 8601 format like YYYY-MM-DD.  Can I insert a</DIV><DIV>filter or something to change the format of the date?  If so what should the</DIV><DIV>code look like.</DIV><DIV><BR></DIV><DIV>Thanks in advance for your help.</DIV><DIV><BR></DIV><DIV><BR></DIV><DIV>John Hockaday</DIV><DIV>Geoscience Australia</DIV><DIV>GPO Box 378</DIV><DIV>Canberra ACT 2601</DIV><DIV>(02) 6249 9735</DIV><DIV><A href="http://www.ga.gov.au">http://www.ga.gov.au</A>/ </DIV><DIV>john.hockaday\@ga.gov.au</DIV><DIV>_______________________________________________</DIV><DIV>Canberra-pm mailing list</DIV><DIV><A href="mailto:Canberra-pm@pm.org">Canberra-pm@pm.org</A></DIV><DIV><A href="http://mail.pm.org/mailman/listinfo/canberra-pm">http://mail.pm.org/mailman/listinfo/canberra-pm</A></DIV> </BLOCKQUOTE></DIV><BR></BODY></HTML>