{"id":3951,"date":"2009-09-09T07:00:41","date_gmt":"2009-09-09T14:00:41","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=3951"},"modified":"2009-09-09T07:00:41","modified_gmt":"2009-09-09T14:00:41","slug":"adjust-server-time","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/snippets\/php\/adjust-server-time\/","title":{"rendered":"Adjust Server Time"},"content":{"rendered":"

Sometimes the time set on your server isn’t accurate to what your local time is. If you can’t change it, you can adjust it yourself.<\/p>\n

$today = date('Y-m-d-G');\r\n$today = strftime(\"%Y-%m-%d-%H\", strtotime(\"$today -5 hour\"));<\/code><\/pre>\n

If your server thought it was 12 midnight, but it was really 7 pm, this will roll the $today variable back five hours to be correct.<\/p>\n","protected":false},"excerpt":{"rendered":"

Sometimes the time set on your server isn’t accurate to what your local time is. If you can’t change it, you can adjust it yourself. $today = date(‘Y-m-d-G’); $today = strftime(“%Y-%m-%d-%H”, strtotime(“$today -5 hour”)); If your server thought it was 12 midnight, but it was really 7 pm, this will roll the $today variable back […]<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":3233,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page-snippet.php","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":""},"tags":[],"acf":[],"jetpack-related-posts":[{"id":207270,"url":"https:\/\/css-tricks.com\/snippets\/html\/start-a-web-server-with-one-terminal-command-on-os-x\/","url_meta":{"origin":3951,"position":0},"title":"Start a Web Server With One Terminal Command on OS X","date":"August 27, 2015","format":false,"excerpt":"I've searched for this three times this week, so I figured I'd better make sure I have a copy of it. Python 2: python -m SimpleHTTPServer 8000 Navigate to the project directory in the terminal and do that command. Then http:\/\/localhost:8000 will server up that directory (as in, it's `index.html`\u2026","rel":"","context":"In \"php\"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":18358,"url":"https:\/\/css-tricks.com\/lodge\/v10\/053-responsive-columns-for-the-gallery\/","url_meta":{"origin":3951,"position":1},"title":"#053: Responsive Columns for the Gallery","date":"September 18, 2012","format":false,"excerpt":"We add in some responsiveness to the grid we have set up for the Gallery. At the widest screens, we have it set at four columns. Then we start adding in breakpoints via our super easy @mixins we have set up and have been re-using all over. At our mama-bear\u2026","rel":"","context":"With 8 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4156,"url":"https:\/\/css-tricks.com\/snippets\/php\/error-page-to-handle-all-errors\/","url_meta":{"origin":3951,"position":2},"title":"Error Page to Handle All Errors","date":"September 19, 2009","format":false,"excerpt":"This is a way to make a single error page for all errors, which is easier to update and maintain. 1) Point all error pages at one location in your .htaccess file ErrorDocument 400 \/error.php ErrorDocument 401 \/error.php ErrorDocument 403 \/error.php ErrorDocument 404 \/error.php ErrorDocument 500 \/error.php etc. 2) PHP\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":200597,"url":"https:\/\/css-tricks.com\/video-screencasts\/139-explaining-the-server-side-mustard-cut\/","url_meta":{"origin":3951,"position":3},"title":"#139: Explaining the Server Side Mustard Cut","date":"April 20, 2015","format":false,"excerpt":"I published a written post about this idea of the Server Side Mustard Cut. So if you're into reading and checking out code samples and stuff, that's the place for you. In this video I just walk through all that, explaining myself as we go. I'll give the same caveat\u2026","rel":"","context":"With 2 comments","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3841,"url":"https:\/\/css-tricks.com\/snippets\/php\/server-side-image-resizer\/","url_meta":{"origin":3951,"position":4},"title":"Server Side Image Resizer","date":"September 4, 2009","format":false,"excerpt":"The code uses PHP to resize an image (currently only jpeg). Using this method, the resized image is of much better quality than a browser-side resizing. The file size of the new downsized image is also smaller (quicker to download). The code comes in two parts: imageResizer() is used to\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":344317,"url":"https:\/\/css-tricks.com\/video-screencasts\/206-building-a-data-backed-next-js-site-with-prisma-app-platform\/","url_meta":{"origin":3951,"position":5},"title":"#206: Building a Data-Backed Next.js Site with Prisma & App Platform","date":"July 12, 2021","format":false,"excerpt":"I'm joined by Chris Sev from Digital Ocean to talk about their new App Platform. We're going to use it to build a little website. The site will be blog-like: posts with IDs, titles, content, and the more dynamic bit, \"likes.\" We're going to use some pretty modern tech to\u2026","rel":"","context":"In \"digitalocean\"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/07\/app-platform-thumb.png?fit=1200%2C675&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3951"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=3951"}],"version-history":[{"count":1,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3951\/revisions"}],"predecessor-version":[{"id":3952,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3951\/revisions\/3952"}],"up":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/pages\/3233"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=3951"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=3951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}