view m-toolbox/classes/+utils/@timetools/reformat_date.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line source

% REFORMAT_DATE reformats the input date
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: REFORMAT_DATE reformats the input date of the (preferred)
%              form 'yyyy-mm-dd HH:MM:SS' to the format 'mm-dd-yyyy HH:MM:SS'
%              which works with datenum.
%
% CALL:       s  = reformat_date(si)
%
% INPUTS:     si - date string in the format 'yyyy-mm-dd HH:MM:SS'
%
% OUTPUTS:    s  - date string in the format 'mm-dd-yyyy HH:MM:SS'
%
% EXAMPLE:    dnum = datenum(reformat_date('2007-05-04 22:34:22'));
%
% VERSION: $Id: reformat_date.m,v 1.1 2008/08/05 18:07:59 ingo Exp $
%
% HISTORY: 03-06-2007 M Hewitson
%             Creation
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function s = reformat_date (s)

  % reformt string to stupid matlab format MM-DD-YYY
  s=strcat(s(6:10),'-',s(1:4),s(11:length(s)));

end