[firebase-br] Data por extenso

Mr.Mothman mr.mothman em gmail.com
Seg Abr 10 20:05:59 -03 2006


Creio que você esteja procurando o conteúdo abaixo, que é um post
recente do Rubem do Nascimento da Rocha, simples e eficiente.

Se tiver problemas para escrever uma Stored Procedure baseado nele,
entre em contato.

[ ]'s

------

Os exemplos abaixo só são válidos para FireBird 1.5 ou maior.

/* data no formato DDMMAA */
select
 case
   when extract(day from current_date) < 10
     then '0' || cast(extract(day from current_date) as varchar(1))
   else cast(extract(day from current_date) as varchar(2))
 end ||
 case
   when extract(month from current_date) < 10
     then '0' || cast(extract(month from current_date) as varchar(1))
   else cast(extract(month from current_date) as varchar(2))
 end ||
 case
   when extract(year from current_date) - 2000 < 10
     then '0' || cast(extract(year from current_date) - 2000 as varchar(1))
   else cast(extract(year from current_date) - 2000 as varchar(2))
 end DDMMYY
 from rdb$database


/* data por extenso */
select cast(extract(day from current_date) as varchar(2)) || ' de ' ||
      case extract(month from current_date)
        when 12 then 'Dezembro'
        when 11 then 'Novembro'
        when 10 then 'Outubro'
        when 09 then 'Setembro'
        when 08 then 'Agosto'
        when 07 then 'Julho'
        when 06 then 'Junho'
        when 05 then 'Maio'
        when 04 then 'Abril'
        when 03 then 'Março'
        when 02 then 'Fevereiro'
        when 01 then 'Janeiro'
      end || ' de ' ||
      cast(extract(year from current_date) as varchar(4)) dia_atual_extenso
 from rdb$database




Mais detalhes sobre a lista de discussão lista