You are currently viewing the GMLscripts.com static mirror. Forum access and script submissions are not available through this mirror.

Invert GMLscripts.com

unix_timestamp

Download
unix_timestamp(datetime)
Returns a Unix timestamp for the current or given GameMaker datetime.
COPY/// @func   unix_timestamp(datetime)
///
/// @desc   Returns a Unix timestamp for the current or given GameMaker datetime.
///
/// @param  {datetime}  datetime    date-time value (default current time)
///
/// @return {real}      Unix timestamp
///
/// GMLscripts.com/license

function unix_timestamp(datetime = date_current_datetime())
{
    var epoch = floor(date_create_datetime(1970, 1, 1, 0, 0, 0));
    return floor(date_second_span(epoch, datetime));
}

Contributors: xot

GitHub: View · Commits · Blame · Raw