The discrete time-cost tradeoff problem (DTCTP) is a well-researched topic in the field of operations research. The majority of existing DTCTP models are based on traditional activity networks, which permit the execution of an activity as soon as all its predecessors have been completed. This assumption is reasonable, but it is important to note that there are always exceptions. The main work of this study was threefold. Firstly, we expanded the analysis of the DTCTP to encompass time-constrained activity networks (DTCTPTC), which encompassed three different types of time constraints. The first constraint was the time-window constraint, which limited the time interval during which an activity could be executed. The second constraint was the time-schedule constraint, which specified the times at which an activity could begin execution. The third constraint was the time-switch constraint, which required project activities to start at specific times and remain inactive during designated time periods. Secondly, a constraint programming (CP) model was developed for the purpose of solving the DTCTPTC. The model employed interval variables to define the activity and its potential time constraints, while CP expressions were utilized to ensure the feasibility of the solution. The objective was to identify the optimal execution mode for each activity, the optimal start times for time-scheduled activities, and the optimal work/rest patterns for time-switch activities, with the aim of minimizing the total cost of the project. Finally, the efficacy of the proposed CP model was validated through two case studies based on two illustrative projects of varying sizes. The outcomes were then compared against existing algorithms. The results demonstrated that time constraints were important factors affecting schedule optimization, and the proposed CP model had the ability to solve large-scale DTCTPTC.