RedM Natives

CONVERT_POSIX_TIME

Takes the specified time and writes it to the structure specified in the second argument.

Hash0xAC97AF97FA68E5D5
Runtime nameConvertPosixTime
NamespaceNETWORK
SideClient
NameOfficial
Docs
Since build1207
GTA V hash0xAC97AF97FA68E5D5

Signature

void CONVERT_POSIX_TIME(int posixTime, Any* timeStructure);

Parameters

NameTypeDescription
posixTimeint—
timeStructureAny*—

Returns void

Description

Takes the specified time and writes it to the structure specified in the second argument.

struct date_time
{
    int year;
    int PADDING1;
    int month;
    int PADDING2;
    int day;
    int PADDING3;
    int hour;
    int PADDING4;
    int minute;
    int PADDING5;
    int second;
    int PADDING6;
};

Usage

Lua
local timeStructure = ConvertPosixTime(posixTime, timeStructure)

-- always works, by hash
local timeStructure = Citizen.InvokeNative(0xAC97AF97FA68E5D5, posixTime, Citizen.PointerValueIntInitialized(timeStructure))
JavaScript and C#
JavaScript
const timeStructure = ConvertPosixTime(posixTime, timeStructure);

// by hash
const timeStructure = Citizen.invokeNative('0xAC97AF97FA68E5D5', posixTime, Citizen.pointerValueIntInitialized(timeStructure));
C#
var timeStructure = new OutputArgument();
Function.Call((Hash)0xAC97AF97FA68E5D5, posixTime, timeStructure);
// timeStructure.GetResult<int>()
  • The last argument is an in/out pointer: pass its initial value, and the updated value is returned after the result.
  • Any* arguments are often structs. Build them with a DataView buffer and pass it with :Buffer() — see the examples and notes below.

Sources

alloc8or RDR3 NativeDB

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.