Why the block's order in blockxxxxx.dat is different from blockchain.info
The blkxxxx.dat files contain the blocks in the order that they were downloaded from peers.  Since the client requests blocks from many different peers in parallel, and different peers may respond at different speeds, it is quite possible for blocks to be downloaded out of order.  (Headers are downloaded first, as a separate step, so the client knows what hashes to request before it gets the full blocks.)

Sorting by timestamp isn't safe either.  See Why are the blocks out of order?  The protocol does not enforce accuracy of the timestamps, and a later block can legally have an earlier timestamp.  At last check there were almost 14000 examples of this in the blockchain.

The only correct way to sort them is to actually reconstruct the chain, using the "previous" field of each block's header to identify the block that should come before it.  This will also help you identify and remove orphan branches and disconnected blocks.