Your first problem is you are assuming that every stock has a duplicate date/time stamp for alignment. This is NOT TRUE.
Intraday data will only have a date/time stamp is a transaction occurs during the time frame of the data. If you have minute data, stock ABC might have trades at:
05/07/2010,1200,...
05/07/2010,1201,...
05/07/2010,1202,...
05/07/2010,1203,...
but a a stock with thin volume might only have trades at:
05/07/2010,1200,...
05/07/2010,1202,...
05/07/2010,1205,...
So the first thing is you will need to add blank date/time stamps where the lack of trades occur.
It gets a bit more complex with tick data, but you didn't say what kind of intraday data you are working with.