Skip to main content

๐Ÿ‡ Get Second

zjkalLess than 1 minute

๐Ÿ‡ Get Second

Tips

This is usually used for setting cache expiration time, setting end time, and so on.

secondEndToday()

Get the number of seconds until midnight tonight

Parameters

nothing

Return Values

The number of seconds between this moment and 0:00 tonight

Example code

/* Get the number of seconds until midnight tonight */
TimeHelper::secondEndToday(); 
// 32811

secondMinute()

Get the number of seconds for N minutes

  • Parameter
ParameterIntroductionRequire
minutesThe number of seconds for how many minutes to returnOptional, the default value is 1

Return Values

N minutes of seconds

Example code

/* Get 5 minutes of seconds */
TimeHelper::secondMinute(5);
// 300

secondHour()

Get the number of seconds for N hours

Parameters

ParameterIntroductionRequire
hoursThe number of seconds for how many hours to returnOptional, the default value is 1

Return Values

The number of seconds for N hours

Example code

/* Get 10 hours of seconds */
TimeHelper::secondHour(10);
// 36000

secondDay()

Get the number of seconds for N days

Parameters

ParameterIntroductionRequire
daysThe number of seconds of how many days to returnOptional, the default value is 1

Return Values

The number of seconds in N days

Example code

/* Get the number of seconds in 1 day */
TimeHelper::secondDay();
// 86400

secondWeek()

Get the number of seconds for N weeks

Parameters

ParameterIntroductionRequire
weeksThe number of seconds of how many weeks to returnOptional, the default value is 1

Return Values

N weeks of seconds

Example code

/* Get the seconds for 1 week */
TimeHelper::secondWeek(1);
// 604800