Found this. Modified a bit to offset in hours, and it sorta works, not totally though… does weird stuff with the time if it’s close to midnight.
Original here
function cc_time_machine( $formatted, $format ) {
$offset = -3; // Offset in hours, can be negative.
if ( $offset ) {
global $post;
$timestamp = get_post_time( 'U', true, $post ); // UTC timestamp with GMT offset included.
$adjusted = $timestamp + ( (int) $offset * HOUR_IN_SECONDS );
return date( $format, $adjusted );
}
// If option doesn't exist, then just return it unmodified.
return $formatted;
}
add_filter( 'get_the_time', 'cc_time_machine', 10, 2 );
Related Posts:
- Is it safe to use ‘date_default_timezone_set’ in plugin file?
- WordPress outputs mm/dd but it should be opposite
- timestamp and scheduled post irregularities
- Can someone explain why wordpress uses two column for storing time values?
- Default timezone hardcoded as UTC?
- How to convert DateTime() to display time based on WordPress timezone setting?
- Why time functions show invalid time zone when using ‘c’ time format?
- Date, Time, and Timezones
- Finding difference in days
- How to get time difference between publish date and now?
- Relative time – how to calculate difference beween post publish date and current time
- UTC/local time in Worpdress
- Convert CST published date time to MST timezone
- How can i display time minus 6 hours
- Display time as “12:00 noon” instead of “12:00 pm”
- How get exact time difference
- Where does the time get pulled from in the_time()
- Human time difference in months instead of days. How?
- Why do I need to set my PHP timezone when it’s already set in WordPress?
- How to get User Time Zone in WordPress?
- Default Timezone setting in WordPress – is that global?
- admin end post published time display not working correctly
- Timezone for Plugin
- How to get Unix Local Time?
- Calculate how much time passed comparing WordPress comment and current time
- Date is showing in unreadable format. How to convert to readable date?
- Proper formatting of post_date for wp_insert_post?
- What’s the difference between get_the_time and get_the_date?
- When does next Cron Job run (time from now)?
- PHP function showing wrong time in WordPress
- Whats the way to format a date after using get_posts()
- Converting Unix timestamp to wordpress date
- What is the best workaround for supporting all existing DATEs?
- Date format with genitive case of the month name is not working
- datetime picker, timestamps and meta queries
- How do I display posts by day?
- Fixing UTC time – wordpress effects
- How to check for WordPress timezone type?
- custom field value date convert to unix timestamp problems
- How would I bulk change posting date?
- Is a MySQL DATETIME or TIMESTAMP value retrieved through $wpdb in UTC?
- How do I create a dynamically-updated copyright statement?
- How can I display the current time? [closed]
- Creating a function within functions.php to change the date
- Calculate future date
- date() returns incorrect value if used from WordPress theme, but correct otherwise
- How to get date using timezone saved in options? [duplicate]
- php console log speed [closed]
- How do I set up my blog home page to show only this weeke’s posts automatically?
- Make WordPress use timezone for email Date header
- Trouble Formatting DateTime
- Placed on + only date (not time)
- Display date and time in comments
- Time Issue xx hours ago
- Get WordPress current date/time
- Show the_date with link
- Displaying time & date problem
- Translate current_time
- Should I escape the attributes when using get_month_link?
- Time & Date on Post – Time Ago Custom Function
- How do I make a page not visible at a certain time? [closed]
- Display posts starting from today date
- Separating publish date and last modified
- Compare date fails when date is in next year [closed]
- How to setup language of a date in a plugin
- How to show different timestamp
- Problems with the_time,the_date, get_the_time
- Comparing Time with the_time();
- Date time doesn’t show correctly in qTranslate [closed]
- Display upcoming events in the next 30 days by querying posts with timestamp in custom meta
- Timed post and tweet?
- wp_dropdown_categories by date?
- How to detect and handle the time difference between server and user in WordPress?
- current_time function incorrect in plugin and PHP, not in WordPress admin
- Apply filters on date format
- How to fix mysql2date() for 5.3.2 version?
- Count time from registration date to today
- Update existing post times to random times?
- Incorrect display of bbpress forum topics & replies
- Can’t add to time? [closed]
- Render the published date/time formatted in ISO 8601 using Timber (.twig)
- Change the year of the whole site
- datetime picker, timestamps and meta queries
- Display datetime in user’s timezone
- Get current week’s day and time outside the loop
- Pull ‘Popular Posts’ within specific timeframe
- How to display time when page is created and edited
- Block post updates and deletion after a set period
- Replicate the_date function when using a custom field
- How to second orderby in “pre_get_posts” by meta value or combine single date and time to timestamp
- Time sort with meta_key using UNIX timestamp failing due to date differences
- Change the counter in terms of date
- Comment time is same as the post time
- Query sub subpages based on specific date?
- Adding a class to last post in the_date
- Get system timestamp in wordpress
- Show monthly or daily archives
- Standard API for rendering a date form
- Datetime on time tag wordpress puts it outside the tag
- WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)