Forum Discussion
nmrao
5 years agoChampion Level 3
Use below: if you just need local date time.
log.info java.time.LocalDateTime.now().plusDays(10).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd"))
- senthkum5 years agoContributor
Hi Mate,
Thanks for sharing the code, but unfortunately it did not work as excepted. It's still giving the result in the below format. "Tue Feb 18 09:55:01 AEDT 2020:INFO:2020-02-18". But I need only the date with "yyyy-MM-dd" format, bcoz I need to send the response based on condition like
1. current date - 7,
2. current date - fortnight,
3. current date - Month,
4. current date - Year,
Thanks
Senthil. M
- richie5 years agoCommunity HeroHi senthkum,
nmrao gave you the correct code.
When you use log.info(variablename), that is writing the variable/property to your logging.
So...when you state the value returned in your logging is "Tue Feb 18 09:55:01 AEDT 2020:INFO:2020-02-18", this is correct.
The actual value for the logged variable/property is the value returned AFTER 'INFO:' in the response.
So in this case the value returned when you executed your groovy script is '2020-02-18' which corresponds to 'yyyy-MM-dd' ehich is what you asked for. :)
Cheers,
Rich - nmrao5 years agoChampion Level 3It is highly appreciated if you can update the thread after the suggestions.
Related Content
- 13 years ago
Recent Discussions
- 5 days ago
- 9 days ago