llms_current_time( string $type, int|bool $gmt )

Retrieve the current time based on specified type.


Description Description

This is a wrapper for the WP Core current_time which can be plugged We plug this during unit testing to allow mocking the current time.

The ‘mysql’ type will return the time in the format for MySQL DATETIME field. The ‘timestamp’ type will return the current timestamp. Other strings will be interpreted as PHP date formats (e.g. ‘Y-m-d’).

If $gmt is set to either ‘1’ or ‘true’, then both types will use GMT time. if $gmt is false, the output is adjusted with the GMT offset in the WordPress option.


Top ↑

Parameters Parameters

$type

(string) (Required) Type of time to retrieve. Accepts 'mysql', 'timestamp', or PHP date format string (e.g. 'Y-m-d').

$gmt

(int|bool) (Optional) Whether to use GMT timezone. Default false.


Top ↑

Return Return

(int|string) Integer if $type is 'timestamp', string otherwise.


Top ↑

Source Source

File: includes/functions/llms-functions-wrappers.php

	function llms_current_time( $type, $gmt = 0 ) {
		return current_time( $type, $gmt );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.3.0 Moved location from includes/llms.functions.core.php.
3.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.