As a beginner I am trying to understand if there is a way to convert this into a one-liner? Have tried to search of course before asking. I need an output in Selenium that outputs HHMM without : . So, I need to know if there's a way to put this into oneline?
const now = new Date();
console.log(now.getHours() "" now.getMinutes());
Thanks a lot for helping out!
CodePudding user response:
This could be an option
console.log(new Date().toTimeString().split(':').slice(0,2).join(' '))
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>