Both directions, with the unit detected for you — because the difference between seconds and milliseconds is a factor of a thousand and a very confusing afternoon.
How the unit is guessed. A 10-digit number is seconds, 13 is
milliseconds, 16 is microseconds — the digit counts do not overlap for any date between
1973 and the year 5138, so the guess is safe in practice. If you paste something
ambiguous, all three readings are shown and you pick.
The 2038 problem is flagged when a value approaches 2 147 483 647 —
the last second a signed 32-bit integer can hold. Systems still storing timestamps that
way wrap to 1901 immediately afterwards.