Home

fromTimestamp

fromTimestamp is a function or factory used in several programming environments to convert a numeric timestamp into a date-time value. It generalizes the idea of translating a raw epoch value into a language’s native date or time object.

The typical purpose of fromTimestamp is to take a point in time represented as a numeric value,

Because unit conventions and time-zone handling differ between ecosystems, correct usage is important. Misinterpreting units (for

Examples across languages illustrate the concept rather than a single standardized signature. In Python, a function

See also: toTimestamp, Unix time, epoch, ISO 8601, time zone.

usually
counting
seconds
since
the
Unix
epoch
(January
1,
1970),
and
produce
a
date-time
representation
in
a
specific
language.
Many
implementations
also
allow
different
units
(seconds,
milliseconds,
or
higher-precision
units)
and
may
provide
a
way
to
specify
the
target
time
zone
or
to
request
a
UTC
result.
The
exact
return
type
depends
on
the
API
and
language,
but
it
is
commonly
a
date-time
object,
a
timestamped
structure,
or
a
string
in
a
standardized
format.
example,
using
milliseconds
where
seconds
are
expected)
can
lead
to
incorrect
dates.
Some
variants
support
nanoseconds
or
customizable
scales,
and
some
return
a
time-zone
aware
value
while
others
output
a
naive/UTC-based
result.
analogous
to
fromTimestamp
may
construct
a
datetime
from
seconds
since
the
epoch,
with
optional
timezone
parameters.
In
JavaScript
and
other
ecosystems,
libraries
or
language
APIs
provide
similar
conversions,
often
requiring
units
to
be
adjusted
(such
as
multiplying
by
1000
to
convert
seconds
to
milliseconds).
In
C#
and
Java,
dedicated
methods
exist
to
create
date-time
values
from
Unix
timestamps,
typically
with
explicit
handling
of
time
zones.