php convert date and time to iso 8601

//Object Oriented Method

$datetime = new DateTime('2010-12-30 23:21:46');

echo $datetime->format(DateTime::ATOM); // Updated ISO8601


//Procedural Method

echo date(DATE_ISO8601, strtotime('2010-12-30 23:21:46'));

4
3
Eddie Kal 95 points

                                    
FYI: there's a list of constants with predefined formats on the DateTime object, for example instead of outputting ISO 8601 dates with:

<?php
echo date('c');
?>

or

<?php
echo date('Y-m-d\TH:i:sO');
?>

You can use

<?php
echo date(DateTime::ISO8601);
?>

instead, which is much easier to read.

4 (3 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
php find date format iso 8601 get datetime now iso8601 php converte created_at date to iso8601 php specified in ISO-8601 format. php php iso 8601 time php format ISO8601 how to convert iso date to date in php php iso8601 date php parse iso 8601 from iso date to php date convert iso data time into date time php date to iso 8601 php convert to iso date php convert string to iso date php iso 8601 php format php ISO 8601 get date iso 8601 to datetime php php datetime from iso string date iso 8601 format php php time iso 8601 format to timestamp php convert date YYY-MM-DD to ISO format (ISO 8601) convert date to iso string php php format ISO 8601 convert a date to iso 8601 php php An ISO 8601 timestamp php convert iso string to date php iso date to datetime change iso 8601 to timestamp in php php date iso to date php datetime iso 8601 formatdate ISO 8601 php iso8601 php php iso 8601 to datetime php date to ISO 8601 php DateTime to ISO-8601 time php datetime in ISO-8601 php ISODate to date convert datetime to iso string php convert datetime to iso format php' convert date time to iso format php php[ date ISO 8601 date iso8601 php php time in ISO 8601 iso8601 format php php date ISO 8602 iso 8601 format php now time ISO-8601 format php php date format from iso date in iso 8601 format php convert date em formato iso 8601 php php iso8601 format iso 8601 format php php iso 8601 date format datetime now php iso 8601 datetime php ISO 8601 php datetime format iso 8601 php datetime from iso8601 php format date to iso 8601 php iso 8601 format ISO 8601 convert iso 8601 to datetime php php date to iso DATE_ISO8601 in php convert date-time ISO 8601 format in php date to iso string php convert date into iso format php php timestamp to ISO 8601 php current date iso 8601 php ISO-8601 date and time iso date formate to php date php convert iso 8601 to datetime php date iso 8601 format php time iso 8601 format local php date ISO 8601 php iso 8601 iso date to date php convert isodate to date time in php php date iso8601 php iso 8601 long format php convert date to iso8601 long php convert date to ISO8601 ISO 8601 php convert iso date to datetime php php time iso 8601 format php date to iso string iso 8601 datetime format php php convert date and time to iso 8601 php iso string to date php convert date to iso format datetime not iso 8601 php php convert date to iso 8601 php ISO8601 php date in iso utc format convert string to iso 8601 php php datetime iso8601 php convert date to iso string php date iso 8601 utc how to get ISO8601. 5:30 using. date time object in. php php datetime to ISO8601 format php time format toIso8601String isoFormat string php php date time from iso-8601 format php date time iso-8601 format translate datetime to iso in php php datetime from iso format to iso string php php convert time to iso 8601 format to iso DateTime to iso php php datetime to iso string js convert date to ISO Dates (Date-Time)
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source