NOTE: This code is for Matlab versions R2014b onwards. If you use an older version of matlab then you should probably checkout datetickzoom. See link in the "inspired by" section.
datetickzoom Date formatted tick labels, automatically updated when zoomed or panned.
Arguments are completely identical to does of DATETICK. The argument
DATEFORM is reset once zoomed or panned.
See also datetick, datestr, datenum
Works in matlab R2014b onwards.
Aslak Grinsted 2015.
Now works with multiple axes in figure
added example, and fixed bug
Inspired by: Datetickzoom - automatically update dateticks