O'Reilly logo

PHP and MySQL Recipes: A Problem-Solution Approach, Second Edition by Frank M. Kromann

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Frank M. Kromann 2016

Frank M. Kromann, PHP and MySQL Recipes, 10.1007/978-1-4842-0605-8_5

5. Dates and Times

Frank M. Kromann

(1)Trabuco Canyon, California, USA

PHP does not have a variable type dedicated to storing date or time values. Instead, integers are used to indicate the number of seconds before or since January 1st, 1970, also called Epoc. When dates and times are treated as a single value they are called a timestamp. The use of integers makes it easy to calculate differences between two timestamps as ordinary math applies.

Recipe 5-1. Working with Time Zones

Problem

All the date and time functions in PHP assume the timestamps to be in Coordinated Universal Time (UTC) . It is necessary to configure PHP to use a specific time zone to convert ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required