Change timezone with TZ environment variable in Windows

If your program uses one of the following MFC or CRT function, then you can change timezone using TZ environment variable:

  • CTime::GetLocalTm
  • CTime::Format
  • COleDateTime::operator=
  • ctime
  • _wctime
  • _tctime
  • _ctime64
  • _wctime64
  • _tctime64
  • mktime
  • _mktime64
  • _utime
  • _wutime
  • _tutime
  • _utime64
  • _wutime64
  • _tutime64

For example, to set the TZ environment variable to correspond to the current time zone in Germany, enter the following on the command line:
set TZ=GST-1GDT
This will add environment variable TZ with value ‘GST-1GDT’.

More about TZ environment variable:
Specifying the Time Zone with TZ
MSDN _tzset from Time Management

PHP $_POST returns only one item for SELECT multiple HTML tag

PHP developers decided that values posted from HTML select tag with attribute multiple, somehow overwrites some internal variable data. Basically it goes like this – you have the following form with a select tag:
<form action="/post.php" method="post">
  <select name="MyMultiSelect" multiple>
    <option>one</option>
    <option>two</option>
    <option>three</option>
    <option>four</option>
  </select>
  <input type="submit" value="send">
</form>

and in PHP you try to access $_POST (An associative array of variables passed to the current script via the HTTP POST method):
var_dump($_POST);

And guess what? When you select, lets say one, two and three in browser, the array looks something like:
array(1) { ["MyMultiSelect"]=> string(5) "three" }

Strangely, the cause is some overwrite that is described in PHP FAQ: How do I get all the results from a select multiple HTML tag? For me it is mystery, why did PHP developers choose to overwrite values posted by HTTP standard post?

The problem is, that they propose to add square brackets to HTML code, like:
<select name="MyMultiSelect[]" multiple>

Beside, that I do not like ‘[]’ in my Valid HTML 4.01 Strict code, the problem is, that you may not have access to that HTML code. In my case it is legacy application, that is available in binary form only.

The solution that I come up is, to use raw $_POST data using PHP file_get_contents in combination with PHP input/output streams namely php://input

php://input allows you to read raw POST data.

Here is a sample code:
$data_from_post = file_get_contents("php://input");
var_dump($data_from_post);

And output is:
string(...) "MyMultiSelect=one&MyMultiSelect=two&MyMultiSelect=three"

CSS pseudo-element first-letter using form label element

Today I spent 1/2 hour trying to understand, why my labels do not respect CSS rule first-letter. Here is an example snippet:
#myform label:first-letter {text-decoration:underline}

<form id="myform" action="/test/" method="post">
<label title="From">From:</label>

The problem was, that The ‘first-letter’ pseudo-element can only be attached to a block-level element.

Reference: w3 – 2.4 The ‘first-letter’ pseudo-element

Also, space is mandatory after ‘first-letter’ in CSS, so that this rule are displayed correctly in older browsers, such as Internet Explorer 6.