USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Fórum

  Visual Basic
Voltar
Autor Assunto:  Calcular Data
Rinaldo
SÃO PAULO
SP - BRASIL
Postada em 28/01/2005 10:31 hs            
Olá Pessoal
 
Alguem sabe como eu faço para encontrar uma data final a partir de uma data inicial decorridos 12 meses. Assim:
 
10/01/2005 + 12 = 10/01/2006
 
T+
Rinaldo
     
Martini
Pontos: 2843 Pontos: 2843
PAROBÉ
RS - BRASIL
ENUNCIADA !
Postada em 28/01/2005 11:41 hs         
DateAdd("m", 12, "10/01/2005")
 
MSDN:
DateAdd Function
     
Returns a Variant (Date) containing a date to which a specified time interval has been added.
Syntax
DateAdd(interval, number, date)
The DateAdd function syntax has these named arguments:
Part Description
interval Required. String expression that is the interval of time you want to add.
number Required. Numeric expression that is the number of intervals you want to add. It can be positive (to get dates in the future) or negative (to get dates in the past).
date Required. Variant (Date) or literal representing date to which the interval is added.

Settings
The interval argument has these settings:
Setting Description
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second

Remarks
You can use the DateAdd function to add or subtract a specified time interval from a date. For example, you can use DateAdd to calculate a date 30 days from today or a time 45 minutes from now.
To add days to date, you can use Day of Year ("y"), Day ("d"), or Weekday ("w").
The DateAdd function won't return an invalid date. The following example adds one month to January 31:
DateAdd("m", 1, "31-Jan-95")
In this case, DateAdd returns 28-Feb-95, not 31-Feb-95. If date is 31-Jan-96, it returns 29-Feb-96 because 1996 is a leap year.
If the calculated date would precede the year 100 (that is, you subtract more years than are in date), an error occurs.
If number isn't a Long value, it is rounded to the nearest whole number before being evaluated.
Note   The format of the return value for DateAdd is determined by Control Panel settings, not by the format that is passed in date argument.
Note   For date, if the Calendar property setting is Gregorian, the supplied date must be Gregorian. If the calendar is Hijri, the supplied date must be Hijri. If month values are names, the name must be consistent with the current Calendar property setting. To minimize the possibility of month names conflicting with the current Calendar property setting, enter numeric month values (Short Date format).
 
 
 
   
Daniel_Gomes
não registrado
Postada em 28/01/2005 15:13 hs   
Olá Rinaldo,
 
A função DateSerial retorna a data final a partir dos parametros que vc passar:
DateSerial(Ano, Mês, Dia)
 
Explo:
DateSerial(2005, 1+6, 1)
Retornará: 01/07/2005
 
Boa Sorte...
     
Página(s): 1/1    


Seu Nome:

Seu eMail:

ALTERAR PARA MODO HTML
Mensagem:

[:)] = 
[:P] = 
[:(] = 
[;)] = 

HTML DESLIGADO

     
 VOLTAR

  



CyberWEB Network Ltda.    © Copyright 2000-2025   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página