From: jacob lalaounis on
Hello,
I have a problem, i try
>> dt=datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM')

dt =

April 13, 2010 12:58:50.FFF PM

why i do not get the milliseconds??

thanx in advance
Matlab version 7.1
From: Wayne King on
"jacob lalaounis" <lalaounisjacob(a)gmail.com> wrote in message <hq1fbm$orn$1(a)fred.mathworks.com>...
> Hello,
> I have a problem, i try
> >> dt=datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM')
>
> dt =
>
> April 13, 2010 12:58:50.FFF PM
>
> why i do not get the milliseconds??
>
> thanx in advance
> Matlab version 7.1

Hi Jacob, when you say you are running Matlab version 7.1, can you enter

>>ver

at the command line and see what the first few lines of output are?

I think if you see an entry like:

(R14) Service Pack 2 or (R14) Service Pack 1, the problem is that the milliisecond output was not supported in those versions. In those versions, your code produces:

April 13, 2010 6:40:30.FFF AM

if you look at the command line help, you will see that milliseconds are not supported.

Beginning in (R14) Service Pack 3, your command returns:

April 13, 2010 6:43:02.507 AM

Hope that helps,
Wayne
From: Jan Simon on
Dear Jacob!

> >> dt=datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM')
> April 13, 2010 12:58:50.FFF PM

You can create a simple and fast workaround (please check it, it is typed in the newsreader and not in Matlab):

Month = {'January', 'Februrary', 'March', 'April', 'May', 'June', 'Juli', 'August', 'September', 'October', 'November', 'December'}; % Please check this...
c = clock;
if c(3) < 12
ampm = 'A';
else
ampm = 'P';
end
dt = sprintf('%s %.2d, %.4d %.2d:%.2d:%6.3f %cM', Month{c(2)}, c(3), c(1), c(4:6), ampm);

Perhaps this is even faster than DATESTR...

Good luck, Jan
From: jacob lalaounis on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <hq1krd$1fa$1(a)fred.mathworks.com>...
> Dear Jacob!
>
> > >> dt=datestr(now,'mmmm dd, yyyy HH:MM:SS.FFF AM')
> > April 13, 2010 12:58:50.FFF PM
>
> You can create a simple and fast workaround (please check it, it is typed in the newsreader and not in Matlab):
>
> Month = {'January', 'Februrary', 'March', 'April', 'May', 'June', 'Juli', 'August', 'September', 'October', 'November', 'December'}; % Please check this...
> c = clock;
> if c(3) < 12
> ampm = 'A';
> else
> ampm = 'P';
> end
> dt = sprintf('%s %.2d, %.4d %.2d:%.2d:%6.3f %cM', Month{c(2)}, c(3), c(1), c(4:6), ampm);
>
> Perhaps this is even faster than DATESTR...
>
> Good luck, Jan


Thanks a lot this Worked!!!!!!!!!!
jacob