Creates a limiting filter on a range of cell timestamps.

## Explore further


For detailed documentation that includes this code sample, see the following:

- [Use filters](https://docs.cloud.google.com/bigtable/docs/using-filters)

## Code sample

### Java


To learn how to install and use the client library for Bigtable, see
[Bigtable client libraries](https://docs.cloud.google.com/bigtable/docs/reference/libraries).


To authenticate to Bigtable, set up Application Default Credentials.
For more information, see

[Set up authentication for a local development environment](https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment).

    public static void filterLimitTimestampRange() {
      // TODO(developer): Replace these variables before running the sample.
      String projectId = "my-project-id";
      String instanceId = "my-instance-id";
      String tableId = "mobile-time-series";
      filterLimitTimestampRange(projectId, instanceId, tableId);
    }

    public static void filterLimitTimestampRange(
        String projectId, String instanceId, String tableId) {
      // A filter that matches cells whose timestamp is from an hour ago or earlier
      // Get a time representing one hour ago
      long timestamp = Instant.now().minus(1, ChronoUnit.HOURS).toEpochMilli();
      try {
        Scan scan = new Scan().setTimeRange(0, timestamp).setMaxVersions();
        readWithFilter(projectId, instanceId, tableId, scan);
      } catch (IOException e) {
        System.out.println("There was an issue with your timestamp \n" + e.toString());
      }
    }

## What's next


To search and filter code samples for other Google Cloud products, see the
[Google Cloud sample browser](https://docs.cloud.google.com/docs/samples?product=bigtable).