In situations where user information and detailed knowledge of user behaviors are challenging to obtain, the session-based recommendation is essential. The session-based recommendation (SBR) relies on the current anonymous session sequence to predict the next action. Recently, sequence modeling methods such as recurrent neural networks have been widely used to model user preferences in session-based recommendations. However, the existing SBR methods usually ignore the click time of interacted items, resulting in inaccurate user preference models and poor recommendations. In this article, we propose a time-aware neural attention network to model dynamic user preferences in SBR tasks. First, a global session graph is constructed based on all sessions, and a graph neural network is used to learn the embedding of items. Then, a gated recurrent unit is used to refine the item embedding and capture the general interests of the user based on the current session. Next, a novel time-aware neural attention network is proposed and used to model the main purpose of the user in the session. Finally, the user’s general interests and main purposes are combined to obtain dynamic user preferences for generating recommendations. Extensive experiments show that our method outperforms state-of-the-art session-based recommendation methods significantly and consistently.