# How database functions determine what t number is?

**URL:** <https://forum.datomic.com/t/how-database-functions-determine-what-t-number-is/1982>\
**Category:** Peer API\
**Created:** [October 12, 2021, 2:35pm UTC](https://forum.datomic.com/t/how-database-functions-determine-what-t-number-is/1982 "2021-10-12T14:35:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolayandr](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/nikolayandr/32/375_2.png) [@nikolayandr](https://forum.datomic.com/u/nikolayandr)\
**Post date:** [October 12, 2021, 2:35pm UTC](https://forum.datomic.com/t/how-database-functions-determine-what-t-number-is/1982/1 "2021-10-12T14:35:03Z")

</div>

How such functions as **as-of** and **since** which API accepts **point t** distinguish this ‘t’ value to determine whether it is transaction number or transaction id ?

---

<div class="post-metadata">

**Author:** ![favila](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/favila/32/283_2.png) [@favila](https://forum.datomic.com/u/favila)\
**Post date:** [October 17, 2021, 1:38pm UTC](https://forum.datomic.com/t/how-database-functions-determine-what-t-number-is/1982/2 "2021-10-17T13:38:29Z")

</div>

An entity id long (64 bits signed) consists of 42 least-significant-bits of “t” and 20 more-significant-bits of partition. The difference between a “t” and a “tx” is just the partition bits of a tx. (The partition of a tx is 3)

There are various functions in the peer api which manipulate entity ids:

d/t-\>tx. Replaces partition bits with partition-3 (tx), keeps t bits the same.

d/tx-\>t replaces partition bits with partition-0 (same as db partition), keeps t-bits the same.

d/part extracts the partition bits

d/entid-at. Constructs an entity id from partition and t separately. The partition arg can be a raw number or an ident (eg :db.part/tx) and the t arg can be any long or an instant that is resolved to a tx.
