I want to leave the option whether to follow DST or not to user's choice. I was trying CST and CST6CDT timezones but bothare giving me same result.
php > $tz = new DateTimeZone('CST');
php >
php > $d = new DateTime('now', $tz);
php > print_r($d);
DateTime Object
(
[date] => 2013-10-16 08:34:53
[timezone_type] => 3
[timezone] => America/Chicago
)
php >
php > $tz = new DateTimeZone('CST6CDT');
php >
php > $d = new DateTime('now', $tz);
php > print_r($d);
DateTime Object
(
[date] => 2013-10-16 08:35:21
[timezone_type] => 3
[timezone] => CST6CDT
)
php >
Is there any way I can get a timestamp without DST? Am I doing anything wrong here?
CST right now IS in DST (except me, being in Saskatchewan where we don't observe DST). So CST and CDT are technically the same time right now. If you'd tried this again in mid-November once the DST switch occurs, you would get different times.
Try GMT-6
instead, which will get you a cst-type time, regardless of DST, because the GMT zones are not DST-dependent.