view m-toolbox/classes/@time/matfrmt2javafrmt.m @ 23:a71a40911c27 database-connection-manager

Update check for repository connection parameter in constructors
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

function frmt = matfrmt2javafrmt(frmt)
% convert MATLAB time formatting specification string into a Java one

  % translate numeric MATLAB time formats into string ones
  if isnumeric(frmt)
    frmt = time.getdateform(frmt);
  end
  
  for kk = 1:length(frmt)
    switch frmt(kk)
      case 'm'
        frmt(kk) = 'M';
      case 'M'
        frmt(kk) = 'm';
      case 'S'
        frmt(kk) = 's';
      case 'F'
        frmt(kk) = 'S';
      case 'P'
        if frmt(kk+1) == 'M'
          frmt(kk)   = 'a';
          frmt(kk+1) = 'a';
        end
    end
  end

  % properly quote the T into ISO8896 date formats
  frmt = strrep(frmt, 'T', '''T''');
end