Unixtimestamp.app date and time operations in PHP

0

Unixtimestamp.app (Unix time, also POSIX time) is a system for describing moments in time. It is defined as the number of seconds that elapsed since midnight on January 1, 1970.

In PHP, the functions time() and strtotime() return the current time stamp. The DateTime class also handles unix timestamps.

Getting time stamps and dates

Number of the day of the week

  • // Monday of the current week:
  • $time = strtotime(‘this week monday, 00:00’);
  • // date(‘d.m.Y H:i’, $time); // 20.02.2023 00:00
  • // Monday of the previous week:
  • $time = strtotime(‘previous week monday, 00:00’);
  • // echo date(‘d.m.Y H:i’, $time); // 13.02.2023 00:00
  • // Monday of next week:
  • $time = strtotime(‘next monday, 00:00’);
  • // Monday of next week: $time = strtime(‘next monday H:i’, $time); // 27.02.2023 00:00
  • PHP
  • * Days of the week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday.

Month Numbers

Current month:

// The first day of the current month:

$time = strtotime(‘first day of this month 00:00’);

// echo date(‘d.m.Y H:i:s’, $time); // 01.02.2023 00:00:00

// Last day of the current month:

$time = strtotime(‘last day of this month 23:59’);

echo date(‘d.m.Y H:i:s’, $time); // 28.02.2023 23:59:00

PHP

Previous month:

// First day of the previous month:

$time = strtotime(‘first day of previous month 00:00’);

// echo date(‘d.m.Y H:i:s’, $time); // 01.01.2023 00:00:00

// Last day of the previous month:

$time = strtotime(‘last day of previous month 23:59’);

echo date(‘d.m.Y H:i:s’, $time); // 31.01.2023 23:59:00

PHP

Next month:

// The first day of the next month:

$time = strtotime(‘first day of next month 00:00’);

// echo date(‘d.m.Y H:i:s’, $time); // 01.03.2023 00:00:00

// Last day of the next month:

$time = strtotime(‘last day of next month 23:59’);

echo date(‘d.m.Y H:i:s’, $time); // 31.03.2023 23:59:00

Why unixtimestamp.app

The unixtimestamp.app website is a simple and handy tool that you can use to convert timestamps between different formats. The website has a clean and minimalistic design that makes it easy to navigate and utilize. The website is also adapted for mobile devices, which means it can be used on any device, including smartphones and tablets.

One of the main features of unixtimestamp.app is the timestamp converter. The converter allows users to enter the date and time in a human-readable format and convert it to a Unix timestamp. Users can also display the time stamp in seconds or milliseconds, depending on their needs. The converter also works in reverse, allowing users to enter the Unix timestamp and convert it to a human-readable date and time.

Overall, the unixtimestamp.app is a simple and useful online tool that can convert, calculate, and generate Unix timestamps. Its user-friendly interface and mobile-friendliness make it easy to use on any device. Its free and no-registration-required nature makes it accessible to anyone who needs to work with Unix timestamps.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More