According to the principles of special relativity, time dilation occurs when an object or observer moves relative to another at a significant fraction of the speed of light. Time dilation means that time appears to pass more slowly for the moving object compared to the stationary observer.
If you were to travel on a spaceship at the speed of light for 1 light year and then return to Earth, from your perspective, the journey would seem almost instantaneous. However, from the perspective of observers on Earth, time would pass differently due to time dilation.
The time experienced by the moving observer (on the spaceship) and the stationary observer (on Earth) can be calculated using the Lorentz transformation equations. For an object moving at relativistic speeds close to the speed of light, these equations are essential.
Using these equations, it can be shown that as you approach the speed of light, time dilation becomes increasingly significant. At the speed of light itself, time dilation becomes infinite, and time essentially stands still for the moving object.
Therefore, if you were to travel at the speed of light for 1 light year and return to Earth, from your perspective, no time would have elapsed. However, for observers on Earth, a considerable amount of time would have passed, depending on the exact velocity you achieved during your journey.