Using command line to change axis format from linear to date

I have a script that generates multiple images from XY paired waves, some of which have a Date as the x axis. I make a wave (DTout) and populate it with date-format values (in seconds) and then do a
setscale x,0,numpnts(DTout), "dat", DTout

so that the units of the DTout wave are "dat"

However, neither tables nor graphs plotted with DTout are subsequently formatted in Date format. I have to manually go to the table or the graph and select format as Date mode for the wave to be updated.

Is there a way to do this in the command line so that I can automate the process?

Thanks
-Farren Thorpe
If your x wave contains date values then you must set its data units, not its X units, to "dat". Here is an example:
Make/D/N=365 xTest = Date2Secs(2013,01,01) + p*24*60*60
SetScale d, 0, 0, "dat", xTest
Make/D/N=365 yTest = p
Display yTest vs xTest

For details execute:
DisplayHelpTopic "Date/Time Axes"