# Get previous messages for 24 hours time frame on load

**URL:** <https://community.sendbird.com/t/get-previous-messages-for-24-hours-time-frame-on-load/4011>\
**Category:** JavaScript\
**Created:** [February 23, 2022, 1:37am UTC](https://community.sendbird.com/t/get-previous-messages-for-24-hours-time-frame-on-load/4011 "2022-02-23T01:37:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![agolovan](https://avatars.discourse-cdn.com/v4/letter/a/34f0e0/32.png) [@agolovan](https://community.sendbird.com/u/agolovan)\
**Post date:** [February 23, 2022, 1:37am UTC](https://community.sendbird.com/t/get-previous-messages-for-24-hours-time-frame-on-load/4011/1 "2022-02-23T01:37:56Z")

</div>

How could I get all previous messages for the last 24 hours, for example. I am using getMessagesByTimestamp and params.nextResultSize, but with this parameter I will limit number of previous messages to display. However, I would love to display ALL message from given timestamp.

---

<div class="post-metadata">

**Author:** ![ScottKim](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/scottkim/32/3330_2.png) [@ScottKim](https://community.sendbird.com/u/ScottKim)\
**Post date:** [February 23, 2022, 5:05am UTC](https://community.sendbird.com/t/get-previous-messages-for-24-hours-time-frame-on-load/4011/3 "2022-02-23T05:05:44Z")

</div>

Hi,  
There is no way to fetch messages by specifying a period.  
This is because navigating over hundreds of millions of messages has to be based on indexed data.

Search by timestamp or message\_id.  
The maximum number of messages that can be browsed at one time is 200, with no more than 100 recommended.  
For example, to get messages 24 hours ago from the current time,  
First, you should get 100 data by the current time and then call it again based on the oldest time (or message\_id) to get 100 data each.

> **[Group channel | Chat JavaScript SDK | Sendbird Docs](https://sendbird.com/docs/chat/v3/javascript/guides/group-channel#2-load-messages-by-timestamp-or-message-id)**
>
> Learn about the features of a group channel.
