In recent years, various types of network attacks emerge in endlessly, the protection of network security has been paid more and more attention by our society. Network Intrusion Detection System (NIDS)is used to protect computer systems from malicious attacks and intrusions, thus has also become a hot research field. Due to the great success of deep learning in industry and academia, there is an increasing interest in the application of deep learning methods for feature representations and classification. In this paper,we propose a intrusion detection model based on time-related deep learning approach with attention mechanism. Firstly, we build a stacked sparse autoencoder(SSAE) to extract high-level feature representations of intrusion information. Then we design a two-layer bidirectional gated recurrent unit(BiGRU) network with attention mechanism to classify traffic data. We perform experiments on a benchmark dataset UNSW-NB15, the results in binary classification indicate that using high-dimensional sparse features extracted by SSAE can significantly accelerate the classification progress. Our model can detect network intrusions effectively and outperform other related methods with reduction of false alarm rate, high accuracy rate, reduced training and testing time.