pandas datetime to string YYYY-MM-DD HH:MM:SS.SSS code example Example: yyyy-mm-dd hh:mm:ss.0 python now = datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")