Jump to content
Fórum Script Brasil
  • 0

Último Dia Do Mes


kuroi

Question

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 post
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.

Guest
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
      148865
    • Total Posts
      644863
×
×
  • Create New...