martedì 28 giugno 2011

Ultimo giorno del mese in VBScript

Function UltimoGiorno(Data_Gio as Date) as Date
if Date_Gio = "" then
Data_Gio = Date
end if
UltimoGiorno = DateSerial( Year(Data_Gio), Month(Data_Gio)+1, 0 )
End Function

lunedì 13 giugno 2011

Ottenere ultimo giorno del mese

Per ottenere la data dell'ultimo giorno del mese

select
DATEADD(month, ((YEAR(GETDATE()) - 1900) * 12) + MONTH(GETDATE()), -1) as fine_mese