{"id":8442,"date":"2021-01-14T03:29:00","date_gmt":"2021-01-14T03:29:00","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=8442"},"modified":"2025-09-01T04:56:02","modified_gmt":"2025-09-01T04:56:02","slug":"how-to-convert-datetime-to-utc-in-mysql","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/","title":{"rendered":"How to Convert datetime to UTC in MySQL"},"content":{"rendered":"\n<p>Often websites and apps need to work in different time zones. In this case, you will need to maintain date\/time information using a single timezone to avoid confusion. Universal Coordinated Time (UTC) is the global standard time used and understood by a large number of people. So you may need to change timezone to UTC or set timezone to UTC. In this article, we will look at how to convert datetime to UTC in MySQL.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#How_to_Convert_datetime_to_UTC_in_MySQL\" >How to Convert datetime to UTC in MySQL<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#Using_Literal_Strings\" >Using Literal Strings<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#Using_Column_Names\" >Using Column Names<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#Using_System_Functions_Variables\" >Using System Functions &amp; Variables<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Convert_datetime_to_UTC_in_MySQL\"><\/span>How to Convert datetime to UTC in MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here are the steps to convert datetime to UTC in MySQL. You can easily change datetime to UTC using <em>convert_tz<\/em> function.<\/p>\n\n\n\n<p>Here is the syntax for convert_tz<\/p>\n\n\n\n<pre id=\"block-b5a7d9ea-e6c9-444d-a9a8-c44dd40ad9a1\" class=\"wp-block-preformatted\">convert_tz(date_value, original_timezone, new_timezone)<\/pre>\n\n\n\n<p>In the above function, you can specify date value as a literal string, system function or column name, its original time zone, as well as its new time zone. The original and new time zones can be specified using offsets or time zone names.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Using_Literal_Strings\"><\/span>Using Literal Strings<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Here is an example to convert date time value from local time zone (GMT+10:00) to UTC(+00:00). By default, you need to specify original (+10:00) and new time zones (+00:00) as offsets from UTC. In the following example, we have input datetime value as a literal string.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; SELECT CONVERT_TZ('2018-06-15 12:00:00','+10:00','+00:00');\n +-----------------------------------------------------+\n | CONVERT_TZ('2018-06-15 12:00:00','+00:00','+10:00') |\n +-----------------------------------------------------+\n | 2018-06-15 02:00:00                                 |\n +-----------------------------------------------------+<\/pre>\n\n\n\n<p>Similarly, you can also convert date, time, date time columns using convert_tz. Here\u2019s an example to change time zone of&nbsp;<em>order_date<\/em>&nbsp;column in&nbsp;<em>sales<\/em>&nbsp;table, from UTC to EST<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; select convert_tz(order_date,'+10:00','+00:00') from sales;\n+------------------------------------------+\n| convert_tz(order_date,'+10:00','+00:00') |\n+------------------------------------------+\n| 2020-05-03 19:00:00                      |\n| 2020-05-04 19:00:00                      |\n| 2020-05-05 19:00:00                      |\n| ...                                      |\n| 2020-05-13 19:00:00                      |\n+------------------------------------------+<\/pre>\n\n\n\n<p>You can also specify time zones instead of offsets. However, in this case, you will need to download and install <a rel=\"noreferrer noopener\" href=\"https:\/\/dev.mysql.com\/downloads\/timezones.html\" target=\"_blank\">MySQL time zones<\/a> on your server. Here&#8217;s an example to convert EST to UTC timezone by specifying time zone names instead of offset values.<\/p>\n\n\n\n<pre id=\"block-747871ac-a7b6-4e6b-bcbb-7cb7ad95a2fb\" class=\"wp-block-preformatted\">mysql&gt; select convert_tz('2020-09-17 03:00:00','US\/Eastern','UTC');<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Using_Column_Names\"><\/span>Using Column Names<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Let us say you have the following table with order_date as datetime column.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; create table sales(id int, amount int, order_date datetime);<br>mysql&gt; insert into sales(id, amount, order_date) values(1, 150, '2024-07-03 14:20');<br>mysql&gt; insert into sales(id, amount, order_date) values(2, 250, '2024-07-03 16:40');<br>mysql&gt; insert into sales(id, amount, order_date) values(3, 200, '2024-07-03 20:25');<br><br>mysql&gt; select * from sales;<br>+------+--------+---------------------+<br>| id   | amount | order_date          |<br>+------+--------+---------------------+<br>|    1 |    150 | 2024-07-03 14:20:00 |<br>|    2 |    250 | 2024-07-03 16:40:00 |<br>|    3 |    200 | 2024-07-03 20:25:00 |<br>+------+--------+---------------------+<\/pre>\n\n\n\n<p>Here is an SQL query where we have converted all values of order_date column to UTC time zone.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; select id, amount, convert_tz(order_date,@@session.time_zone,'+00:00') as order_date from sales;<br>+------+--------+---------------------+<br>| id   | amount | order_date          |<br>+------+--------+---------------------+<br>|    1 |    150 | 2024-07-03 08:50:00 |<br>|    2 |    250 | 2024-07-03 11:10:00 |<br>|    3 |    200 | 2024-07-03 14:55:00 |<br>+------+--------+---------------------+<\/pre>\n\n\n\n<p>In this case, when MySQL reads and displays each row, convert_tz() will read and convert the value of order_date column and display the after-conversion value in query result.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Using_System_Functions_Variables\"><\/span>Using System Functions &amp; Variables<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>You can also use convert_tz with system functions such as now() or system variables. The following query will convert local time to UTC. The now() function will return current date and time, and local time zone is stored in session.time_zone variable.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; SELECT CONVERT_TZ( NOW(), @@session.time_zone, '+00:00' );<br>+----------------------------------------------------+<br>| CONVERT_TZ( NOW(), @@session.time_zone, '+00:00' ) |<br>+----------------------------------------------------+<br>| 2024-07-03 08:48:35                                |<br>+----------------------------------------------------+<\/pre>\n\n\n\n<p>Hopefully, now you can convert datetime to UTC in MySQL. Similarly, you can also convert UTC to local time in MySQL.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt how to convert datetime to UTC using convert_tz() function. You can also use it to convert datetime values to any other time zones. Typically, database programmers and web developers store all information using a single time zone, in their databases. When a web server sends it to the client browser, it is automatically converted and displayed as local time, by the web browser itself. It is important if your website or app is used by people in multiple time zones. It is also required to factor things like daylight savings.<\/p>\n\n\n\n<p><a href=\"http:\/\/ubiq.co\/\">Ubiq<\/a>&nbsp;makes it easy to visualize data in minutes, and monitor in real-time dashboards.&nbsp;<a href=\"http:\/\/ubiq.co\/accounts\/register\">Try it<\/a>&nbsp;Today!<\/p>\n\n\n\n<p>Also read:<br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-utc-to-local-time-in-mysql\/\">How to Convert UTC to Local time in MySQL<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-current-date-and-time-in-mysql\/\">How to Get Current Date &amp; Time in MySQL<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-group-by-month-in-mysql\/\">How to Group By Month in MySQL<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you may need to set timezone to UTC or change timezone to UTC. Here is how to convert datetime to UTC in MySQL<\/p>\n","protected":false},"author":1,"featured_media":8444,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[324],"tags":[456],"class_list":["post-8442","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","tag-convert-datetime"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Convert datetime to UTC in MySQL - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Sometimes you may need to set timezone to UTC or change timezone to UTC. Here is how to convert datetime to UTC in MySQL\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Convert datetime to UTC in MySQL - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Sometimes you may need to set timezone to UTC or change timezone to UTC. Here is how to convert datetime to UTC in MySQL\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-14T03:29:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-01T04:56:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2021\/01\/convert-datetime-to-utc-mysql.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Convert datetime to UTC in MySQL\",\"datePublished\":\"2021-01-14T03:29:00+00:00\",\"dateModified\":\"2025-09-01T04:56:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/\"},\"wordCount\":573,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2021\/01\/convert-datetime-to-utc-mysql.webp?fit=600%2C400&ssl=1\",\"keywords\":[\"convert datetime\"],\"articleSection\":[\"MySQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/\",\"name\":\"How to Convert datetime to UTC in MySQL - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2021\/01\/convert-datetime-to-utc-mysql.webp?fit=600%2C400&ssl=1\",\"datePublished\":\"2021-01-14T03:29:00+00:00\",\"dateModified\":\"2025-09-01T04:56:02+00:00\",\"author\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Sometimes you may need to set timezone to UTC or change timezone to UTC. Here is how to convert datetime to UTC in MySQL\",\"breadcrumb\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2021\/01\/convert-datetime-to-utc-mysql.webp?fit=600%2C400&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2021\/01\/convert-datetime-to-utc-mysql.webp?fit=600%2C400&ssl=1\",\"width\":600,\"height\":400,\"caption\":\"convert datetime to utc\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ubiq.co\/tech-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Convert datetime to UTC in MySQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/\"],\"url\":\"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Convert datetime to UTC in MySQL - Ubiq BI","description":"Sometimes you may need to set timezone to UTC or change timezone to UTC. Here is how to convert datetime to UTC in MySQL","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/","og_locale":"en_US","og_type":"article","og_title":"How to Convert datetime to UTC in MySQL - Ubiq BI","og_description":"Sometimes you may need to set timezone to UTC or change timezone to UTC. Here is how to convert datetime to UTC in MySQL","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2021-01-14T03:29:00+00:00","article_modified_time":"2025-09-01T04:56:02+00:00","og_image":[{"width":600,"height":400,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2021\/01\/convert-datetime-to-utc-mysql.webp","type":"image\/webp"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Convert datetime to UTC in MySQL","datePublished":"2021-01-14T03:29:00+00:00","dateModified":"2025-09-01T04:56:02+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/"},"wordCount":573,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2021\/01\/convert-datetime-to-utc-mysql.webp?fit=600%2C400&ssl=1","keywords":["convert datetime"],"articleSection":["MySQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/","name":"How to Convert datetime to UTC in MySQL - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2021\/01\/convert-datetime-to-utc-mysql.webp?fit=600%2C400&ssl=1","datePublished":"2021-01-14T03:29:00+00:00","dateModified":"2025-09-01T04:56:02+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Sometimes you may need to set timezone to UTC or change timezone to UTC. Here is how to convert datetime to UTC in MySQL","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2021\/01\/convert-datetime-to-utc-mysql.webp?fit=600%2C400&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2021\/01\/convert-datetime-to-utc-mysql.webp?fit=600%2C400&ssl=1","width":600,"height":400,"caption":"convert datetime to utc"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-convert-datetime-to-utc-in-mysql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Convert datetime to UTC in MySQL"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2021\/01\/convert-datetime-to-utc-mysql.webp?fit=600%2C400&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-2ca","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=8442"}],"version-history":[{"count":2,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8442\/revisions"}],"predecessor-version":[{"id":9375,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/8442\/revisions\/9375"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/8444"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=8442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=8442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=8442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}