You would have to convert from the datetime object back to a date number using datnum:
q = now + [0:6]';
dtv = datetime(q, 'Format','yyyy-MM-dd', 'ConvertFrom','datenum');
dnv = datenum(dtv);
To use polyfit optimally in this context, depending on what your resulting datenum vector was, ask it for all three outputs in order to scale and centre your data, then pass them to polyval to produce a vector of correctly fitted points. To display the dates and times on your plot, use the datetick function with the date numbers in the ‘dnv’ vector here.