Tag Archives — Date Time

Get the Current Timestamp in JavaScript

As a developer, every now and then, you will need to get the current timestamp in JavaScript. It allows us to represent both the current date and time as a single number. There are many ways to get the current timestamp or epoch time or number of seconds since January 1, 1970 00:00:00 UTC. In […]

Get the Current Date and Time in JavaScript

There are a lot of scenarios where you might want to get the current date and time in JavaScript. For instance, you might be creating a website where you want to change the theme based on time of the day like setting a dark theme at night or you might simply want to display the […]

PHP DatePeriod Class Methods

DatePeriod class Methods in PHP Function Name Function Description DatePeriod::__construct() Creates a new DatePeriod object DatePeriod::getDateInterval() Gets the interval DatePeriod::getEndDate() Gets the end date DatePeriod::getRecurrences() Gets the number of recurrences DatePeriod::getStartDate() Gets the start date PHP DatePeriod::__construct() Method What does DatePeriod::__construct() do? The PHP DatePeriod::__construct() method creates a new DatePeriod object. PHP DatePeriod::__construct() Syntax PHP […]

PHP DateTime Class Methods

DateTime class Methods in PHP Function Name Function Description DateTime::add() Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object DateTime::__construct() Returns new DateTime object DateTime::createFromFormat() Parses a time string according to a specified format DateTime::createFromImmutable() Returns new DateTime object encapsulating the given DateTimeImmutable object DateTime::getLastErrors() Returns the warnings and […]