Snippets tagged “date”
36 snippets use this tag.
- 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 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 java.util.Date to StringJava
To convert a java.util.Date object to a String, you can use the format method of the SimpleDateFormat class from the java.text package. The SimpleDateFormat class provides a convenient way to convert a Date object to a String based on a specified format.
- 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.
- Given a Unix timestamp, how to get beginning and end of that day?PHP
You can use the strtotime() function in PHP to convert a Unix timestamp to the beginning and end of that day.
- 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 a Date without time in Java?Java
To get a java.util.Date object with the time set to 00:00:00 (midnight), you can use the toInstant() method to convert a LocalDate object to an Instant, and then use the atZone() method to convert the Instant to a ZonedDateTime object, and finally use the
- 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 Get the Current Year in JavaScriptJavaScript
Read this tutorial and learn about the simplest and fastest method of getting the current year a four-digit number using the Date object in JavaScript.
- How to Check Whether an Object is a DateJavaScript
Read this JavaScript tutorial and learn several ways that are used for checking whether the parameter passed to the method is of type Date object or not.
- How to Clone a Date Object in JavaScriptJavaScript
Read the tutorial and learn two useful methods that are used to clone the Date object in JavaScript. Get the current date and the cloned one right away.
- How to Convert a JavaScript Date to UTCJavaScript
In this tutorial, you will read and learn useful information about the right way of converting a JavaScript Date to the Coordinated Universal Time standard.
- How to Convert a String into a Date in JavaScriptJavaScript
Read this tutorial and learn the way of converting a string into a Date. Also, read about UTC method, ISO format and much more to get a relevant answer.
- How to Convert a Unix Timestamp to Time in JavaScriptJavaScript
Read the tutorial and find how you can convert the UNIX timestamp to time in JavaScript to make the Unix format date-time value in a user-readable format.
- how to convert java string to Date objectJava
To convert a string to a Date object in Java, you can use the parse() method of the SimpleDateFormat class.
- 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 determine day of week by passing specific date?Java
To determine the day of the week for a specific date in Java, you can use the get() method of the Calendar class.
- 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 a Timestamp in JavaScriptJavaScript
Almost all the developers come across the question: how to get a timestamp in JavaScript. This tutorial will help you find the most efficient methods to use.
- How to Get the Client Timezone Offset in JavaScriptJavaScript
Read this tutorial and learn several useful methods that are used to detect the client timezone offset in JavaScript easily. Choose the best one for you.
- How to Get the Current Date and Time in JavaScriptJavaScript
The tutorial provides information of getting the current date, time and both by running a simple piece of code. Also, get the full explanation of the code.
- 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 the first day of the current year?PHP
In PHP, you can use the mktime function to get the Unix timestamp of the first day of the current year, then use the date function to format it as a date string.
- How to get the last day of the month?Python
You can use the calendar.monthrange() function from the calendar module in Python to get the last day of a month.
- 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 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 Days from Date in JavaScriptJavaScript
Read this tutorial and learn useful information about the instance methods of the Date object to help you subtract days from date in JavaScript easily.
- Java string to date conversionJava
To convert a string to a date in Java, you can use the parse method of the SimpleDateFormat class.
- Java: Get month Integer from DateJava
To get the month integer from a java.util.Date object in Java, you can use the getMonth() method of the java.util.Calendar class.
- java.util.Date format conversion yyyy-mm-dd to mm-dd-yyyyJava
To convert the format of a java.util.Date object from yyyy-MM-dd to MM-dd-yyyy, you can use the SimpleDateFormat class and its format() method.
- java.util.Date to XMLGregorianCalendarJava
To convert a java.util.Date object to an XMLGregorianCalendar in Java, you can use the toGregorianCalendar method of the DatatypeFactory class.
- PHP subtract 1 month from date formatted with date ('m-Y')PHP
You can use the DateTime object in PHP to subtract one month from a date formatted with date('m-Y').
- Select records from today, this week, this month php mysqlPHP
To select records from today, you can use the following code:
- The “right” JSON Date FormatJavaScript
Read the tutorial and learn the right methods of JSON date formatting with the help of JavaScript. Get to know information about ISO 8601 string format.