Using computer simulation, we investigate a propagation of laser pulse with a few cycles in a linear layered medium with dielectric permittivity modulated in time. This means that we consider, so called, temporal photonic crystal. Such kind of crystals is produced, for example, by action of another laser beams propagating perpendicular to a propagation direction for a laser beam under consideration. Therefore, such photonic crystal may be induced for various ranges of frequencies, from optical range of frequencies to infrared range of frequencies, and may exist during time of the laser beam action. The process under consideration is described by 1D Maxwell’s equations. We investigated light energy localization in such time-dependent structure in dependence of both absolute phase of pulse, and duration of dielectric permittivity increasing. We believe that a considering scheme of laser pulse interaction with medium can be used in processing of data by optical method, for example.