View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

4.8 | 15 ratings Rate this file 29 Downloads (last 30 days) File Size: 3.42 KB File ID: #8313 Version: 1.0
image thumbnail



Elmar Tarajan (view profile)


18 Aug 2005 (Updated )

UIGETDATE displays a dialog box in form of a calendar.

| Watch this File

File Information

UIGETDATE date selection dialog box
   T = UIGETDATE(D) displays a dialog box in form of a calendar
   UIGETDATE expects serial date number or standard MATLAB Date
   format (see DATESTR) as input data und returns serial date number
   for the selected date and time.

   UIGETDATE by itself uses the current date and time as input data

        t = datestr( uigetdate('16-Aug-1974 03:00') )

See also datevec, datestr, datenum


This file inspired Plot Me The Greeks and Uisetdate2(Varargin).

MATLAB release MATLAB 7.0.4 (R14SP2)
Other requirements tested under R13/R13SP1/R14/R14SP1/R14SP2/R14SP3
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (18)
11 May 2016 Noam Greenboim

One issue that's needed to be fixed is the CLOSEREQ call.
Like Tal Shir recognized before, when UIGETDATE is called within another GUI, closing the window causes the closure of the calling GUI.
to fix that:
replace line 120: closereq
with this: delete(findobj(0,'Tag','uigetdate'))

02 Oct 2015 Remberto Martin

excellent - works on OS X

15 Jan 2015 Juan Vallejo

Gracias, es justo lo que buscaba

25 Jan 2014 per isakson

uigetdate has served well for many years, but now the new version of datenum (R2013b?) issues an error.


% tmp = {'Januar' 'Februar' 'March' 'April' 'May' 'Juni' 'Juli' ...
% 'August' 'September' 'October' 'November' 'December'};
tmp = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'};


out = datenum([num2str( ...
get(findobj(gcf,'Tag','cday'),'UserData')) '-' ...
get(findobj(gcf,'Tag','months'),'String') '-' ...
get(findobj(gcf,'Tag','year' ),'String') ' ' ...
get(findobj(gcf,'Tag','time' ),'String') ':00'] ...
, 'dd-mmm-yyyy HH:MM:SS' );

I added the format specifier.

Now it seems to work again.

Comment only
20 Aug 2013 Yaad

Yaad (view profile)

GREAT work!

16 Aug 2013 JY Su

JY Su (view profile)

Amazing !!

22 Aug 2012 Liam Kelly

Great tool. However, it will not compile as a stand alone application with the MCR compiler because of the use of strings as callback functions (e.g. ...'callback','uigetdate(gcbo,''year'')')

Comment only
22 Aug 2012 Liam Kelly

27 Jul 2011 Jan Simon

Jan Simon (view profile)

Hi Elmar! This is the the nicest and coolest GUI built by conventional MATLAB methods I've ever seen. Beside the usability, it is an excellent example for advanced programmers. Thanks!

17 Dec 2010 Deshan Yang

Deshan Yang (view profile)

Fantastic. It is exactly what I need.

15 Jun 2010 Vincent De Paul

This is a fantastic DateGUI, as Matlab doesn't have such utilities. It can be easily integrated in any Matlab code, in which a calendar is need.

Great Job

Comment only
09 Apr 2010 Tal Shir

Sorry for adding the rating twice. a small point is the try catch lines. If the gui is used in a parent gui the closereq command will close the main gui in case the x button was used to close the uigetdate. a solution can be to add the following lines between catch and end:
out = [];
if strcmp(get(gcf,'tag'),'uigetdate') % close only if calander is not close already

03 Jun 2008 Gilles Criton

I have not yet practice a full test in order to see if there are some bugs, but at first glance, this function is very impressive and useful ! Thank you very much

16 Aug 2007 Blaz Daskobler

Indeed a very handy tool, thanks a lot.
But, as a previous user observed, the "closereq" command (line 120 to be precise, not 127) needs to be commented out.
You close the uigetdate figure with the "X" (or Close) anyway, and that's why that "closereq" command closes the figure calling uigetdate.

04 Jan 2007 per isakson

It looks nice and works well. However, I encounter a minor issue. When I click the Close Button in the Title Bar "my" figure is closed together with the uigetdate figure. By stepping through the code with the debugger I see that <line 117 uiwait> closes the uigetdate figure and that <line 127 closereq> closes my figure. Don't ask me why (R2006b)! Commenting out <line 127> seems to solve the issue.

26 Oct 2006 Malcolm Wood

This is really impressive.

10 Aug 2006 Kevin Delaney

Just what I was looking for!

30 Aug 2005 Andreas Geissler

Hello, the M-File works great.
No problems !

Contact us