# I want to get the current time from the server using IP

**URL:** <https://community.hivepress.io/t/i-want-to-get-the-current-time-from-the-server-using-ip/12724>\
**Category:** HivePress\
**Tags:** code\
**Created:** [November 2, 2024, 8:19am UTC](https://community.hivepress.io/t/i-want-to-get-the-current-time-from-the-server-using-ip/12724 "2024-11-02T08:19:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![techicman](https://community.hivepress.io/user_avatar/community.hivepress.io/techicman/32/11472_2.png) [@techicman](https://community.hivepress.io/u/techicman)\
**Post date:** [November 2, 2024, 8:19am UTC](https://community.hivepress.io/t/i-want-to-get-the-current-time-from-the-server-using-ip/12724/1 "2024-11-02T08:19:39Z")

</div>

I want to get the current time from the server using ip so i am using ap-api for that, but it is free for 45 reqests per minute . so can you suggest some other methods i will post my code below

```auto
function get_user_time_zone() {
    $ip_address = $_SERVER['REMOTE_ADDR'];
    $response = wp_remote_get('http://ip-api.com/json/');
    if (is_wp_error($response)) {
        return 'UTC';
    }
    $data = json_decode(wp_remote_retrieve_body($response));
    return $data && isset($data->timezone) ? $data->timezone : 'UTC';
}

```

---

<div class="post-metadata">

**Author:** ![andrii](https://community.hivepress.io/user_avatar/community.hivepress.io/andrii/32/2951_2.png) [@andrii](https://community.hivepress.io/u/andrii)\
**Post date:** [November 5, 2024, 8:40am UTC](https://community.hivepress.io/t/i-want-to-get-the-current-time-from-the-server-using-ip/12724/4 "2024-11-05T08:40:17Z")

</div>

Hi,

Please note that this is a custom development and is not a HivePress scope. We recommend checking other APIs as we are not familiar with this API.

---

<div class="post-metadata">

**Author:** ![system](https://community.hivepress.io/user_avatar/community.hivepress.io/system/32/13990_2.png) [@system](https://community.hivepress.io/u/system)\
**Post date:** [December 5, 2024, 8:41am UTC](https://community.hivepress.io/t/i-want-to-get-the-current-time-from-the-server-using-ip/12724/5 "2024-12-05T08:41:17Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
