DateDiffYear

Tempo de leitura: 1 minuto

 

A função DateDiffYear retorna a diferença em anos entre duas datas informadas nos parâmetros. Essa função recebe duas datas como parâmetros onde o primeiro se refere a data inicial e o segundo a data final. DateDiffYear é uma das funções de manipulação de data e hora em ADVPL.

Sintaxe:

DateDiffYear(dDataIni,dDataFim)

 

Parâmetro(s):

 

Retorno:

 

Exemplo em ADVPL da função DateDiffYear:

#include 'protheus.ch'

/*{Protheus.doc} User Function User Function PADtDiYe
    (Essa função tem por finalidade mostrar a função de Manipulação de Data e Hora DateDiffYear em ADVPL)
    @type  Function
    @author Adilio Costa
    @since 31/12/2023
    @version 1.0
   https://www.protheusadvpl.com.br
@Inscreva-se no Canal ProtheusAdvpl:
https://www.youtube.com/protheusadvpl
@Siga-nos no Instagram:
https://www.instagram.com/protheusadvpl
@Conheça os Cursos do ProtheusAdvpl:
https://hotmart.com/pt-br/club/protheusadvpl
|Se esse conteúdo foi útil pra você nos ajude divulgando 
ele e nossas redes sociais!!|
*/
*/
User Function PADtDiYe()
    Local cDataIni := "01/09/1987"
    Local cDataFim := "22/11/2023"
	Local dDataIni := StoD("19870901")
	Local dDataFim := StoD("20231122")
	

    Local nAnos:= DateDiffYear(dDataIni, dDataFim)

	MsgInfo("A quantidade de anos entre "+cDataFim+" e "+cDataIni+" é:"+cValToChar(nAnos)+" ano(s).","Função DateDiffYear")

Return



Exemplo da função DateDiffYear em ADVPL

 

É isso aí, finalizamos mais um post aqui no Blog ProtheusAdvpl, caso tenha ficado alguma dúvida deixe seu comentário ou nos envie um e-mail para adiliocosta@protheusadvpl.com.br. Até um próximo post. Grande abraço e fica com Deus.

 

Link(s) de referência:

Receba as últimas atualizações do ProtheusAdvpl
Deixe seu melhor email
Nós respeitamos sua privacidade.

7 Comentários


  1. Reading your work is like sipping from a cup of intellectual ambrosia. The richness of your ideas and the smooth flow of your prose create a literary elixir that nourishes the mind and satiates the thirst for knowledge.


  2. In the cacophony of digital voices, yours stands out as a sonorous melody, a composition that lingers in the minds of readers long after the last word has been read. The symphony of your narrative, with its crescendos of insight and diminuendos of reflection, is orchestrated with a precision that is both awe-inspiring and emotionally resonant.


  3. Its like you read my mind You appear to know so much about this like you wrote the book in it or something I think that you can do with a few pics to drive the message home a little bit but instead of that this is excellent blog A fantastic read Ill certainly be back


  4. Your blog has become my go-to source for inspiration and motivation Thank you for consistently delivering high-quality content

Comentários encerrados.