Micro Focus QTP (UFT) Forums

Full Version: Code for getting the next "the 1st in month"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all

I need a code snippet that saves the next 1st date in a month in a variable NewDate. In this case the value of NewDate would be 11012009

Anyone who has an idea ?
Hi,
Try this...
Code:
Dim TmpDate, NewDate
   TmpDate = DateAdd("mm", 1, Date)
   NewDate = DateSerial(Year(TmpDate), Month(TmpDate), 1)
Hi Janriis,

Try with the below way.
Code:
Dim TmpDate1,TmpDate2
   TmpDate1 = DateAdd("m",1, Date)
   TmpDate2 = DateSerial(Year(TmpDate1),Month(TmpDate1),1)
   NewDate=replace(TmpDate2,"/","")
   Msgbox NewDate

Hope it helps you.Smile
Exactly what i needed, thx. How do i insert the value of NewDate into my txtDate field ?
Hi,

Assuming date field is of class webedit.
You can have Browser().Page().webedit().set NewDate