Zum Hauptinhalt gehen

Suche

Suche

Problem Getting Warranty End Date Correct Dd/mm/yy

Kommentare

1 Kommentar

  • Avatar
    Shotaro Ito

    Hi Paul,
    To add date, use DateAdd vbs function.

    'get todays date'
    dateToday = Now()
    
    'add 7 days, then 3 years, then 2 months'
    dateBegin = DateAdd("d",7,dateToday)
    dateBegin3yrs = DateAdd("yyyy",3,dateBegin)
    dateEnd = DateAdd("m",2,dateBegin3yrs)
    
    'reformat to dd/mm/yy'
    dd = Right("0" & Day(dateEnd),2)
    MM = Right("0" & Month(dateEnd),2)
    yy = Right(Year(dateEnd),2)
    Value = dd & "/" & MM & "/" & yy

    --
    Good news - you can do that without VB Script, in Ver 10.0 or later.
    Note that you need 3 text to do that:

    Text1: Clock(today) : Type Date : Offset 7 days
    Text2: Object value of Text1 : Type Date: Offset 3 years
    Text3: Object value of Text2 : Type Date(Format custom dd/MM/yy) : Offset 2 months

    hide Text1 and Text2 as these are interim object.

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.