Niall
Niall

Reputation: 435

PHP UNIX Timestamp int(10) DST

Dates are my nemesis, I just can't figure them out so excuse the lame question! I support a LAMP based application. At 2am tomorrow, the clocks go back 1hr due to Daylight Savings. I am just trying to figure out if I need to make any adjustments to my app code and/or data. Here is the setup:

Server Time is UTC

PHP Timezone is set with date_default_timezone_set('Europe/Dublin');

The MySql Table CREATE statement is:

CREATE TABLE  `databasename`.`events` (
`id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR( 40 ) NOT NULL ,
`event_date` INT( 10 ) UNSIGNED NOT NULL
) ENGINE = MYISAM ;

I store events using:

mysql_query("INSERT INTO `events` (`name`, `event_date`) VALUES ('name', ".time().")");

I check for upcoming events in the database using a query similar to this:

mysql_query("SELECT `id`, `name` FROM `events` WHERE `event_date` - " . time() . " < 0");

Will events after 2am tomorrow go out 1 hr early or should I be ok?

Upvotes: 0

Views: 487

Answers (1)

bcat
bcat

Reputation: 196

'Europe/Dublin' should use Dublin's DST (switch automatically), so you're good

Upvotes: 1

Related Questions