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?
- How to get WordPress Time Zone setting?
- 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
- Running WP Cron on specific local time
- 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?
- Serve visitor post time adjusted to their timezone
- Fixing UTC time – wordpress effects
- How to check for WordPress timezone type?
- Echo Messages By Checking current_time()
- 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?
- Query by custom dates in UNIX Time
- If else statement based on date_diff value
- How do I create a dynamically-updated copyright statement?
- How do you format the date as a two digit year? (ex. “10.12.10” instead of “10.12.2010”)
- How can I display the current time? [closed]
- I get “The PHP Date/Time library is not supported by your web host.” on my CentOS host, what library to I need to install to add support?
- 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]
- display month in french in wordpress/php?
- Change wordpress current_time function to different timezone
- Timezone UTC to PST
- How do I set up my blog home page to show only this weeke’s posts automatically?
- Randomised Post Time
- 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
- Separately formatting date elements
- 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]
- wordpress blog posts’s time
- 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?
- WordPress Translate Date Function is giving Error
- 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