Make a dynamic year dropdown using PHP
Ever wanted to have a dropdown that automatically showed the current year and the few years before it? This is a quick and easy way to do exactly that! [code lang=”php”]
Ever wanted to have a dropdown that automatically showed the current year and the few years before it? This is a quick and easy way to do exactly that! [code lang=”php”]
It’s really very simple to convert times in different timezones using the following function. [code lang=”php”] function dateTimeConversion($datetime, $timezone=”Europe/London”) { $date = new DateTime($datetime, new DateTimeZone(“UTC”)); $date->setTimezone($timezone); return $date->format(“Y-m-d H:i:s”); } [/code] As you can see, it takes 2 arguments, $datetime which is a time string and a $timezone which Read more…
With the following function you can easily convert an integer containing seconds to a nice days, hours, minutes, seconds string or array. [code lang=”php”] function secondsToTime($seconds, $return_type=”string”) { // extract days $days = floor($seconds / 3600 / 24); // extract hours $hours = floor($seconds / 3600) – $days*24; // extract Read more…
I needed to work out a date range according to the date 3weeks away from the current date. After a bit of thinking, I found that it’s actually quite easy to achieve. [code lang=”actionscript”] var theDate:Date = new Date(); dateDay = theDate.getDate(); dateMonth = theDate.getMonth(); dateYear = theDate.getFullYear(); var theDate2:Date Read more…