How-to articles, tricks, and solutions about DATETIME

Convert column integer values into date expressions

To convert column integer values into date expressions in PHP, you can use the date function.

Convert date to datetime in Python

You can convert a date to datetime in Python using the datetime module.

Convert java.util.Date to java.time.LocalDate

To convert a java.util.Date object to a java.time.LocalDate object, you can use the java.time.Instant class to represent the date as an instant in time, and then use the java.time.LocalDateTime class to convert the instant to a date and time in the local

Convert Pandas Column to DateTime

To convert a column in a Pandas DataFrame to a datetime data type, you can use the pandas.to_datetime() function.

Convert string "Jun 1 2005 1:33PM" into datetime

To convert the string "Jun 1 2005 1:33PM" into a datetime object, you can use the datetime module in the Python standard library.

Converting unix timestamp string to readable date

You can use the datetime module in Python to convert a UNIX timestamp string to a readable date.

Extracting just Month and Year separately from Pandas Datetime column

You can extract the month and year separately from a Pandas datetime column using the dt accessor.

Get integer value of the current year in Java

To get the integer value of the current year in Java, you can use the Calendar class and the get method.

Getting today's date in YYYY-MM-DD in Python?

You can use the datetime module in Python to get the current date in the YYYY-MM-DD format.

How can I parse/format dates with LocalDateTime? (Java 8)

In Java 8 and later, you can use the java.time.LocalDateTime class to represent a date and time without a time zone. To parse a date and time string into a LocalDateTime object, you can use the java.time.format.DateTimeFormatter class.

How do I compare two DateTime objects in PHP 5.2.8?

To compare two DateTime objects in PHP 5.2.8, you can use the DateTime::diff() method, which returns a DateInterval object representing the difference between the two dates.

How do I convert 2018-04-10T04:00:00.000Z string to DateTime?

To convert a string in the format "2018-04-10T04:00:00.000Z" to a DateTime object in Java, you can use the org.joda.time.DateTime class and the DateTimeFormatter class.

How do I convert a datetime to date?

You can use the date() function from the datetime module in Python to convert a datetime object to just a date object.

How do I get the current time in milliseconds in Python?

You can use the time module in Python to get the current time in milliseconds.

How do I get the current time?

To get the current time in Python, you can use the datetime module from the standard library.

How do I get the day of week given a date?

You can use the datetime module in Python to get the day of the week for a given date.

How do I parse an ISO 8601-formatted date?

You can use the datetime.fromisoformat() method to parse an ISO 8601-formatted date in Python.

How to add 5 minutes to current datetime on php < 5.3

You can use the strtotime function in PHP to add a certain number of minutes to a date and time.

How to add one day to a date?

There are a few different ways to add one day to a date.

How to calculate number of days between two given dates

To calculate the number of days between two dates, you can use the timedelta class from the datetime module.

How to Calculate the Difference between Two Dates Using PHP?

On this page, you have an opportunity to get comprehensive information on how to calculate the difference between two dates with the help of PHP.

How to Convert DateTime to String in PHP

If you wish to manipulate with the DateTime object in PHP, then this snippet is for you. Here, you will learn how to correctly convert DateTime to string.

How to convert java.util.Date to java.sql.Date?

To convert a java.util.Date object to a java.sql.Date object in Java, you can use the java.sql.Date constructor that takes a long value as an argument.

How to find day of week in php in a specific timezone

To find the day of the week in PHP in a specific timezone, you can use the date function and specify the timezone using the date_default_timezone_set function.

How to get current timestamp in string format in Java? "yyyy.MM.dd.HH.mm.ss"

To get the current timestamp in string format in Java, you can use the SimpleDateFormat class and specify the desired format string.

1 2