Stay organized with collections
Save and categorize content based on your preferences.
Constructors
constructor
- new Timestamp
(
seconds
:
number
,
nanoseconds
:
number
)
:
Timestamp
-
Parameters
-
seconds: number
-
nanoseconds: number
Properties
nanoseconds
nanoseconds: number
Methods
valueOf
- valueOf
(
)
:
string
-
Returns string
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-07-27 UTC.
[null,null,["Last updated 2022-07-27 UTC."],[],[],null,["- [firebase](/docs/reference/js/v8/firebase).\n- [firestore](/docs/reference/js/v8/firebase.firestore).\n- Timestamp \nA Timestamp represents a point in time independent of any time zone or\ncalendar, represented as seconds and fractions of seconds at nanosecond\nresolution in UTC Epoch time.\n\nIt is encoded using the Proleptic Gregorian\nCalendar which extends the Gregorian calendar backwards to year one. It is\nencoded assuming all minutes are 60 seconds long, i.e. leap seconds are\n\"smeared\" so that no leap second table is needed for interpretation. Range is\nfrom 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.\n\nsee\n\n: \u003chttps://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto\u003e\n\nIndex\n\nConstructors\n\n- [constructor](/docs/reference/js/v8/firebase.firestore.Timestamp#constructor)\n\nProperties\n\n- [nanoseconds](/docs/reference/js/v8/firebase.firestore.Timestamp#nanoseconds)\n- [seconds](/docs/reference/js/v8/firebase.firestore.Timestamp#seconds)\n\nMethods\n\n- [isEqual](/docs/reference/js/v8/firebase.firestore.Timestamp#isequal)\n- [toDate](/docs/reference/js/v8/firebase.firestore.Timestamp#todate)\n- [toMillis](/docs/reference/js/v8/firebase.firestore.Timestamp#tomillis)\n- [valueOf](/docs/reference/js/v8/firebase.firestore.Timestamp#valueof)\n- [fromDate](/docs/reference/js/v8/firebase.firestore.Timestamp#fromdate)\n- [fromMillis](/docs/reference/js/v8/firebase.firestore.Timestamp#frommillis)\n- [now](/docs/reference/js/v8/firebase.firestore.Timestamp#now)\n\nConstructors\n\nconstructor\n\n- new Timestamp ( seconds : number , nanoseconds : number ) : [Timestamp](/docs/reference/js/v8/firebase.firestore.Timestamp)\n- Creates a new timestamp.\n\n Parameters\n -\n\n seconds: number \n The number of seconds of UTC time since Unix epoch\n 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n 9999-12-31T23:59:59Z inclusive.\n -\n\n nanoseconds: number \n The non-negative fractions of a second at nanosecond\n resolution. Negative second values with fractions must still have\n non-negative nanoseconds values that count forward in time. Must be\n from 0 to 999,999,999 inclusive.\n\n Returns [Timestamp](/docs/reference/js/v8/firebase.firestore.Timestamp)\n\nProperties\n\nnanoseconds \nnanoseconds: number\n\nseconds \nseconds: number\n\nMethods\n\nisEqual\n\n- isEqual ( other : [Timestamp](/docs/reference/js/v8/firebase.firestore.Timestamp) ) : boolean\n- Returns true if this `Timestamp` is equal to the provided one.\n\n Parameters\n -\n\n other: [Timestamp](/docs/reference/js/v8/firebase.firestore.Timestamp) \n The `Timestamp` to compare against.\n\n Returns boolean\n\n true if this `Timestamp` is equal to the provided one.\n\ntoDate\n\n- toDate ( ) : Date\n- Convert a Timestamp to a JavaScript `Date` object. This conversion causes\n a loss of precision since `Date` objects only support millisecond precision.\n\n Returns Date\n\n JavaScript `Date` object representing the same point in time as\n this `Timestamp`, with millisecond precision.\n\ntoMillis\n\n- toMillis ( ) : number\n- Convert a timestamp to a numeric timestamp (in milliseconds since epoch).\n This operation causes a loss of precision.\n\n Returns number\n\n The point in time corresponding to this timestamp, represented as\n the number of milliseconds since Unix epoch 1970-01-01T00:00:00Z.\n\nvalueOf\n\n- valueOf ( ) : string\n- Converts this object to a primitive string, which allows Timestamp objects to be compared\n using the `\u003e`, `\u003c=`, `\u003e=` and `\u003e` operators.\n\n Returns string\n\nStatic fromDate\n\n- fromDate ( date : Date ) : [Timestamp](/docs/reference/js/v8/firebase.firestore.Timestamp)\n- Creates a new timestamp from the given date.\n\n Parameters\n -\n\n date: Date \n The date to initialize the `Timestamp` from.\n\n Returns [Timestamp](/docs/reference/js/v8/firebase.firestore.Timestamp)\n\n A new `Timestamp` representing the same point in time as the given\n date.\n\nStatic fromMillis\n\n- fromMillis ( milliseconds : number ) : [Timestamp](/docs/reference/js/v8/firebase.firestore.Timestamp)\n- Creates a new timestamp from the given number of milliseconds.\n\n Parameters\n -\n\n milliseconds: number \n Number of milliseconds since Unix epoch\n 1970-01-01T00:00:00Z.\n\n Returns [Timestamp](/docs/reference/js/v8/firebase.firestore.Timestamp)\n\n A new `Timestamp` representing the same point in time as the given\n number of milliseconds.\n\nStatic now\n\n- now ( ) : [Timestamp](/docs/reference/js/v8/firebase.firestore.Timestamp)\n- Creates a new timestamp with the current date, with millisecond precision.\n\n Returns [Timestamp](/docs/reference/js/v8/firebase.firestore.Timestamp)\n\na new timestamp representing the current date."]]
A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time.
It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are "smeared" so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto