{"id":1186,"date":"2025-10-23T05:25:00","date_gmt":"2025-10-22T20:25:00","guid":{"rendered":"https:\/\/touhyo.com\/blog\/?p=1186"},"modified":"2025-11-24T19:12:11","modified_gmt":"2025-11-24T10:12:11","slug":"compare-save-times","status":"publish","type":"post","link":"https:\/\/touhyo.com\/blog\/en\/compare-save-times\/","title":{"rendered":"Compare save times"},"content":{"rendered":"\n<p>When storing \u201ctime data\u201d in a database, you don&#8217;t save values as strings, right? Since only numbers are stored, choosing a numeric data type helps reduce storage space.<\/p>\n\n\n\n<p>The following string and integer types represent the same time.<\/p>\n\n\n\n<p><strong>&#8211; String Type<\/strong><br>2025\/10\/25 02:15:25<\/p>\n\n\n\n<p><strong>&#8211; Integer Type<\/strong><br>1761358525<\/p>\n\n\n\n<p>The \u201cInteger type\u201d value mentioned above is a UNIX timestamp. Including milliseconds adds three more digits. For reference, the format including milliseconds is as follows.<\/p>\n\n\n\n<p><strong><strong>&#8211; String Type<\/strong><\/strong><br>2025\/10\/25 02:15:25.123<\/p>\n\n\n\n<p><strong><strong>&#8211; Integer Type<\/strong><\/strong><br>1761358525123<\/p>\n\n\n\n<p>Including milliseconds makes it 13 digits. The lightest option is 10 digits without milliseconds. Since integer types contain only pure numbers without slashes or other symbols, they are lighter as data. Whether to use milliseconds generally depends on whether fine-grained timestamp precision is required.<\/p>\n\n\n\n<p>UNIX timestamps are based on UTC time. Therefore, when using them in Japan Standard Time, a +9 hour adjustment is required. While UNIX timestamps are used to reduce database size, since they represent global time, conversion may be necessary during comparisons depending on the situation.<\/p>\n\n\n\n<p>The method for comparing times varies depending on how values are stored within the database. Whether times are stored in Japan Standard Time or Coordinated Universal Time (UTC) also involves complex considerations.<\/p>\n\n\n\n<p>Keep in mind that integer types are the lightest on the database.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When storing \u201ctime data\u201d in a database, you don&#8217;t save values as strings, right? Since only numbers are stored, choosing a numeric data type helps reduce storage space. The following string and integer types represent the same time. &#8211; String Type2025\/10\/25 02:15:25 &#8211; Integer Type1761358525 The \u201cInteger type\u201d value mentioned above is a UNIX timestamp. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"https:\/\/touhyo.com\/blog\/?p=1163","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1186","post","type-post","status-publish","format-standard","hentry","category-memo","en-US"],"_links":{"self":[{"href":"https:\/\/touhyo.com\/blog\/wp-json\/wp\/v2\/posts\/1186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/touhyo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/touhyo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/touhyo.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/touhyo.com\/blog\/wp-json\/wp\/v2\/comments?post=1186"}],"version-history":[{"count":9,"href":"https:\/\/touhyo.com\/blog\/wp-json\/wp\/v2\/posts\/1186\/revisions"}],"predecessor-version":[{"id":1394,"href":"https:\/\/touhyo.com\/blog\/wp-json\/wp\/v2\/posts\/1186\/revisions\/1394"}],"wp:attachment":[{"href":"https:\/\/touhyo.com\/blog\/wp-json\/wp\/v2\/media?parent=1186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/touhyo.com\/blog\/wp-json\/wp\/v2\/categories?post=1186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/touhyo.com\/blog\/wp-json\/wp\/v2\/tags?post=1186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}