I'm using net user command in a batch script to find the last login time of a user :
net user administrator | findstr /B /C:"Last logon"
The result looks like this :
Last logon 04/23/2020 9:02 AM
I would like to display the date and time only and remove Last logon
How can i achieve this ?
Thanks.


You could optionally use WMI for this task, which should provide you with a date and time string which is universally parseable.
If you want a specific user:
Alternatively if you want a listing of users:
[Edit /?]
Based upon the question you've asked in comment to another answer, and because I've already indicated that my solution(s) above provide a universally parseable date and time format, you can further adapt it to output only the hour.
For example:
Of course, this does not identify on which day that logon occurred, but your additional requirement was specific!