function test_timeformat(varargin)

if nargin == 0
  [conn, username] = mysql_connect('localhost', 'ltpda_test');
else
  conn = varargin{1};
  username = varargin{2};
end

%% Submit a timeformat
default_matlab_str = 'yyyy-mm-dd HH:MM:SS';
default_matlab_nr  = 31;
default_java_str   = 'yyyy-MM-dd HH:mm:ss';

p = timeformat(getappdata(0, 'time_format_str'),...
                default_matlab_str,...
                default_matlab_nr,...
                default_java_str);
              

sinfo.conn                   = conn;
sinfo.username               = username;
sinfo.experiment_title       = 'submit timeformat';
sinfo.experiment_description = 'this is just a test of the whole thing';
sinfo.reference_ids          = '';
sinfo.additional_comments    = 'none';
sinfo.additional_authors     = 'no one';


[ids, cid] = ltpda_obj_submit(p, sinfo);

%% Retrieve the object

q = ltpda_obj_retrieve(conn, cid);

%% Close connection
if nargin == 0
  close(conn);
end


%% Test

if p ~= q
  error('### timeformat objects are not the same.')
end
