Snippets tagged “datetime”
43 snippets use this tag.
- Add 30 days to datePHP
In PHP, you can add 30 days to a date by using the DateTime class and the modify() method.
- Add 30 seconds to the time with PHPPHP
You can use the strtotime function in PHP to add a specified number of seconds to a given time.
- Checking if date is weekend PHPPHP
To check if a date is a weekend in PHP, you can use the date function to get the day of the week for a given date and then check if it is either 0 (Sunday) or 6 (Saturday).
- Convert column integer values into date expressionsPHP
To convert column integer values into date expressions in PHP, you can use the date function.
- Convert date to datetime in PythonPython
You can convert a date to datetime in Python using the datetime module.
- Convert date to day name e.g. Mon, Tue, WedPHP
In PHP, you can use the date function to convert a date to a day name.
- Convert Pandas Column to DateTimePython
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 datetimePython
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 datePython
You can use the datetime module in Python to convert a UNIX timestamp string to a readable date.
- Creating new Date Time from stringPHP
In PHP, you can use the DateTime class to create a new date and time object from a string.
- Does Python's time.time() return the local or UTC timestamp?Python
The time.time() function in Python returns the current timestamp in seconds since the epoch (January 1, 1970) in the local timezone.
- Elegant way to get the count of months between two dates?PHP
There are multiple ways to get the count of months between two dates in PHP, but one elegant way is to use the DateTime class and the diff() method.
- Extracting just Month and Year separately from Pandas Datetime columnPython
You can extract the month and year separately from a Pandas datetime column using the dt accessor.
- Get current date, given a timezone in PHP?PHP
To get the current date and time in a specific timezone in PHP, you can use the date_default_timezone_set function to set the timezone and then use the date function to get the current date and time.
- Getting today's date in YYYY-MM-DD in Python?Python
You can use the datetime module in Python to get the current date in the YYYY-MM-DD format.
- How can I use PHP to dynamically publish an ical file to be read by Google Calendar?PHP
Here's an example of how you can use the iCalcreator library to create an iCal file and output it for download:
- How do I compare two DateTime objects in PHP 5.2.8?PHP
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?Java
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?Python
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?Python
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?Python
You can use the datetime module in Python to get the day of the week for a given date.
- How do I make a time delay?Python
There are several ways to add a delay to your Python program.
- How do I parse an ISO 8601-formatted date?Python
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.3PHP
You can use the strtotime function in PHP to add a certain number of minutes to a date and time.
- How to calculate number of days between two given datesPython
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?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 check if a date is in a given range?PHP
In PHP, you can use the DateTime class to check if a date is within a given range.
- How to Convert DateTime to String in PHPPHP
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 seconds to time format?PHP
To convert seconds to a time format in PHP, you can use the date function and specify the format you want to use.
- How to count days between two dates in PHP?PHP
You can use the DateTime class in PHP to calculate the number of days between two dates.
- How to display a date as iso 8601 format with PHPPHP
You can use the date() function in PHP to display a date in ISO 8601 format.
- How to find day of week in php in a specific timezonePHP
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 AM/PM from a datetime in PHPPHP
To get the AM/PM value for a given date and time in PHP, you can use the date() function with the a format string.
- How to Get the Current Date and Time in PHPPHP
In this short tutorial, we are going to represent to you the most essential ways of getting current date and time in php.
- How to Get the Current Year with PHPPHP
On this page, you will get solutions to a common issue in PHP: how to get the current year.
- How to get time difference in minutes in PHPPHP
To get the time difference in minutes between two dates in PHP, you can use the DateTime class and the diff() method.
- How to make a countdown using PHPPHP
One way to make a countdown using PHP is to use the time() function, which returns the current timestamp, and subtract a future timestamp (representing the end date and time of the countdown) from it.
- How to overcome "datetime.datetime not JSON serializable"?Python
One way to overcome "datetime.datetime not JSON serializable" in Python is to use the json.dumps() method with the default argument, default=str, which converts the datetime object to a string before serializing.
- How to print a date in a regular format?Python
In Python, you can use the datetime module to work with dates and times.
- How to separate DATE and TIME from DATETIME in MySQL?PHP
You can use the DATE() and TIME() functions to extract the date and time parts of a DATETIME value in MySQL.
- How to subtract a day from a date?Python
You can use the datetime module in Python to subtract a day from a date.
- PHP How to find the time elapsed since a date time?PHP
You can use the DateTime class in PHP to find the time elapsed since a specific date time.
- Simple DatePicker-like CalendarPHP
A simple DatePicker-like calendar can be created using the PHP DateTime class and some basic HTML and CSS.