print a date and time in command window MATLAB
Based on Mathworks' documentation here, datetime returns an array, not a string. Therefore, you cannot use disp to display a string Date and time is together with that returned array.

Your second method is also not working because again Dtimes is an array and you cannot use %s to print it.

Your last method is working because datestr returns a string see documentation.

Please let me know if this explanation is not clear/enough.