Use the_time
or get_the_time
, which accept the same format parameters as php’s date
.
// assign to a variable
$iso8601_date = get_the_time('c');
// or output directly
the_time('c');
EDIT- converting formats with php:
$date = "September 11, 2011 9:00 am";
$time = strtotime( $date );
echo date( 'c', $time );
Related Posts:
- How to get WordPress Time Zone setting?
- Converting timestamps to local time with date_l18n()
- PHP function showing wrong time in WordPress
- How to get year, month and hour in WordPress?
- Why does this echo values in the wrong order?
- WordPress returns a wrong date
- How to check for WordPress timezone type?
- Unable to set right time in admin and frontend template
- wrong php date()?
- display month in french in wordpress/php?
- Displaying the Month and Year that a page was Created?
- Get date numerical and separate?
- Print last modified date only on posts
- Find hours between post_date and post_date_gmt
- 3 different times on my WordPress website
- How to get User Time Zone in WordPress?
- Check If Post Was Published More Than 6 Months Ago Using get_the_date
- How do I check or test a WordPress Auto Year Change Script?
- Shortcode function doesnt work without caption
- Comparing Dates from custom field
- Get date function not working
- PHP time function ($today) for GMT +1
- Hide publish date when update date
- If Post Published Date or Modified Date is 1 Year or Older, Display Notice on Post Page
- How to detect and handle the time difference between server and user in WordPress?
- No more get_option(‘date_time’) in WordPress 5.5?
- WordPress wrong dates bug
- How to pull date/time in french format for wordpress post?
- Can’t add to time? [closed]
- Ordering / grouping posts by datepicker ACF
- Array sorting assistance
- Adding a number to a date
- Display Year and Month from custom field + Age Calculator
- Can i show items based on the day with php?
- Display Current Time using shortcode
- How do I convert a custom field to a php date format? [closed]
- Change date/time format in custom plugin
- Convert custom field date format to “WordPress default”
- Twitter feed is showing blank in WP site [closed]
- Unique key for each row in a repeater field
- Show different Customizer Settings on Page-Tamplates
- get_term_link() returns correct – But illogical error-messages disturb
- How to modify a global variable in a function and use it on another function?
- How to send get request to file.php right and where to store that file.php?
- PHP echoes value without the use of echo
- How to remove ?p= from wordpress short links
- How to make function appear in sentence?
- Save html content of a widget textarea
- Widgets not showing on custom theme
- Custom query vars filters problem with pagination
- Adding wp_list_categories to a specific div that was appended using jQuery
- Search AJAX Filters – Multiple Query Loops Into One Loop (Optimization)
- WP_Query: How to get results from both meta_key options?
- Passing in MySQL prepare statement parameter separately throwing error
- searching for members in wordpress
- Edit Post custom options not working
- jQuery doesn’t work in my php snippet
- Changing code to remove 2 records for the first line
- use system script advertising in wordpress multisite
- Errors while Loading Most Recent Version of jQuery
- How I can give a php page a style from my theme
- how to display tables via ajax
- Login user into magento using wordpress account
- save array of objects with update_option
- What is the best way to reset the site? Different fails while set up
- How to conditionally concatenate and translate two very long strings?
- How to limit the number of posts in the wordpress loop in conjunction with the “download more” button?
- seo meta description issue in google search
- Redirect loop upon installation of my plugin
- Find owner of coupon
- ‘This Field is Required.’ is Not Displaying on CF7 [closed]
- REST API custom endpoints for metaboxes
- Add default block css when the block has been added with php?
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Custom Post Type doesn’t have template content when creating programmatically in PHP but does when created in WP Admin
- Use of undefined constant issue
- Themeco Looper Provider Query String for current user posts [closed]
- Remove colon from CTP UI “Singular Label”
- Customize create table SQL statement in any WordPress plugin
- Deprecated: stripos(): Error in WordPress After Updating to php 8.1
- How can I display all these movies in DESC order by modified?
- Remove /Page/ from slug when we’re visiting 2nd and other inner pages of the blog page
- WordPress Query – Blog Cards Duplicate issue
- PHP Works only for logged in users: [closed]
- WordPress wp_remote_request() – How to do async await in wordpress php?
- How Create Automatically Image jpg.webp from image .jpg without delete or change original images upload
- Need help with conditional logic for menus
- Disabling User Email Notifications for Erase Personal Data Utility
- Facing Problem While Running WordPress Hook For Archive, Categories, Author, Date Pages Only
- generate excerpt from the part of big text dump that contains keyword
- How to sort search result by post_title, then by post_content
- Custom Admin Menu Report for Specific User ID
- how can i link threejs in my functions.php file in understrap theme
- WordPress / PHP: Check if column has value and then check if value in array
- How can add alt tag in following code. Image are showing dynamic in wordpress
- how to create twitter card without plugin in wordpress website?
- How to use phpspreadsheet reader with $wpdb
- How to modify default tags in wp_head()
- Can’t insert into a database wordpress
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress