Jump to content
Fórum Script Brasil
  • 0

Último Dia Do Mes



já vi mta gente se mantando pra saber qual o ultimo dia do mes, tentando calcular ano bissexto e etc e fazendo uma funcao gigante com varios ifs e etc (eu mesmo fazia assim). na verdade não precisa de nd disso. arranjei um jeito simples aqui de fazer q funciona sempre pra qualquer mes, qualquer ano e qualquer dia q esteja na data:

Public Function UltimoDia(datax As Date) As Date
    UltimoDia = DateAdd("m", 1, DateSerial(Year(datax), Month(datax), 1))
    UltimoDia = DateAdd("d", -1, UltimoDia)
End Function[/code]

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...