Skip to content

Instantly share code, notes, and snippets.

View thomas-kl1's full-sized avatar
🐘
My Job: Daveloper

Thomas Klein thomas-kl1

🐘
My Job: Daveloper
View GitHub Profile
version: '3.3'
services:
php:
build:
context: .
dockerfile: dockerfile
container_name: php81
depends_on:
- db
@thomas-kl1
thomas-kl1 / countdown_timezone.js
Last active February 4, 2022 21:25
Timezone aware countdown
// Print the date from the server side, in UTC+0
const endDate = new Date('2022-02-04T23:00:00+00:00');
const countdown = setInterval(function() {
const date = new Date();
const currentDate = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds()));
const diff = endDate - currentDate;
const days = Math.floor(diff / (1000 * 60 * 60 * 24));
const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
<?php
/*
Copyright 2013 Stuart Carnie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to