Difference between revisions of "NXSL:mktime"

(Created page with "__NOTOC__ Converts broken down time (represented by object of TIME class) to UNIX time (number of seconds since epoch). TIME object can be returned...")
 
m (Text replacement - "^" to "{{deprecated}}")
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
__NOTOC__
{{deprecated}}__NOTOC__
Converts broken down time (represented by object of [[NXSL:TIME|TIME]] class) to UNIX time (number of seconds since epoch). [[NXSL:TIME|TIME]] object can be returned by [[NXSL:localtime|localtime]] or [[NXSL:gmtime|gmtime]] functions or created using operator '''new'''. Broken down time assumed to be local time.
Converts broken down time (represented by object of [[NXSL:TIME|TIME]] class) to UNIX time (number of seconds since epoch). [[NXSL:TIME|TIME]] object can be returned by [[NXSL:localtime|localtime]] or [[NXSL:gmtime|gmtime]] functions or created using operator '''new'''. Broken down time assumed to be local time.


Line 19: Line 19:


UNIX time (number of seconds since epoch).
UNIX time (number of seconds since epoch).
== Example ==
<syntaxhighlight lang="c">
t = new TIME();  // create new TIME object
t->year = 2018;
t->mon = 3; // April (0-based month numbering)
t->mday = 10;
t->hour = 10;
t->min = 16;
t->sec = 55;
t->isdst = -1; // auto detect daylight saving
println mktime(t);
</syntaxhighlight>

Latest revision as of 18:13, 13 September 2022

This Wiki is deprecated and we are are currrently migrating remaining pages into product documentation (Admin Guide, NXSL Guide)

Converts broken down time (represented by object of TIME class) to UNIX time (number of seconds since epoch). TIME object can be returned by localtime or gmtime functions or created using operator new. Broken down time assumed to be local time.


Syntax

mktime(time);


Parameters

time Broken down time (object of TIME class).


Return Value

UNIX time (number of seconds since epoch).


Example

t = new TIME();  // create new TIME object
t->year = 2018;
t->mon = 3;	// April (0-based month numbering)
t->mday = 10;
t->hour = 10;
t->min = 16;
t->sec = 55;
t->isdst = -1;	// auto detect daylight saving
println mktime(t);