MATLAB: Date formats

dateformatMATLAB

hi,
i have a .txt file containing dates in such a format : Sat Oct 01 20:00:00 BST 2011, where BST stands for British Summer Time. I want to read the file and transform to datenums based on the format: 01-Oct-2011 20:00:00 is there any quick way (in terms of processing as some files contain more than 10000 dates) to do this? Thanks in advance, ~Conrad

Best Answer

Assuming that all the dates are in BST and that you are not trying to adjust for different time zones ...
x = 'Sat Oct 01 20:00:00 BST 2011';
datestr(datenum(x([1:20,25:28]), 'ddd mmm dd HH:MM:SS yyyy'), 'dd-mmm-yyyy HH:MM:SS')