# CFX::GET_PLAYER_TIME_ONLINE

- **Hash:** `0x67D2E605`
- **Namespace:** CFX
- **Runtime name (Lua/JS):** `GetPlayerTimeOnline`
- **Side:** server (Cfx runtime native)
- **Name status:** official
- **Documentation:** described with examples
- **URL:** https://natives.borderlinerp.com/natives/CFX/GET_PLAYER_TIME_ONLINE

## Signature

```c
int GET_PLAYER_TIME_ONLINE(char* playerSrc);
```

## Parameters

- `playerSrc` (`char*`) — A player.

## Returns

`int` — The current time online in seconds.

## Description

*Source: Cfx.re native reference*

Gets the current time online for a specified player.

## Usage

### Lua

```lua
local retval = GetPlayerTimeOnline(playerSrc)

-- always available, by hash
local retval = Citizen.InvokeNative(0x67d2e605, playerSrc, Citizen.ResultAsInteger())
```

### JavaScript

```js
const retval = GetPlayerTimeOnline(playerSrc);

// by hash
const retval = Citizen.invokeNative('0x67d2e605', playerSrc, Citizen.returnResultAnyway(), Citizen.resultAsInteger());
```

### C#

```csharp
int retval = Function.Call<int>((Hash)0x67d2e605, playerSrc);
```

## Examples

*Source: Cfx.re native reference*

```lua
local function ShowTimeOnline()
    local player = source
    local secondsTotalOnline = GetPlayerTimeOnline(player)

    print(("Time online : %f H %f min %f"):format(
        (secondsTotalOnline / 3600),
        ((secondsTotalOnline / 60) % 60),
        (secondsTotalOnline % 60)
    ))
end

RegisterNetEvent("myTimeOnline", ShowTimeOnline)
```

*Sources: Cfx.re native reference.*
