How to put yesterday's date into text box

Could you tell me how to put yesterday’s date into text box in certain web page?
when today is 2/16/2020 then it is 2020-02-15

Thanks,

see 5. Date Arithmetic

1 Like

hi,

use this
import java.time.LocalDate
LocalDate date = LocalDate.now().minusDays(1);
println ("DEBUG current date minus day "+date)
DEBUG current date minus day 2020-02-15

1 Like

Hi, Timo

I am just new to Katalon. So could you tell me where I use this formula in katalon studio UI ?

Hi,
anywhere you will need to use it, KS or keyword

1 Like

you have to use the script-view for this approach

1 Like

Hi Timo!

Using the script you’ve provided, how do I change the format of the date from 2020-02-15 to 02/15/2020?

Thanks a lot!

Read “7 Date and Time formatting” in https://www.baeldung.com/java-8-date-time-intro