Đang chuẩn bị liên kết để tải về tài liệu:
PHP Programming with PEARXML, Data, Dates, Web Services, and Web APIs - Part 9
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Làm việc với Ngày Chương này giới thiệu ngày và phần Thời gian PEAR. Nó bao gồm các gói ngày, Date_Holidays, và Lịch. Bạn sẽ thấy những gì giúp họ cung cấp và tìm hiểu làm thế nào để sử dụng chúng để giải quyết ngày và các vấn đề liên quan đến thời gian. Bạn có thể truy cập ngày và phần Thời gian trực tuyến tại http://pear.php.net | .5 Working with Dates This chapter introduces PEAR s Date and Time section. It covers the packages Date Date_Holidays and Calendar. You will see what help they offer and learn how to use them to solve date- and time-related problems. You can visit the Date and Time section online at http pear.php.net packages.php catpid 8 catname Date and Time. After reading the chapter you will be able to use these packages as a replacement for PHP s native date and time functions. Knowledge of these three libraries will help you to program robust date-related applications. Working with the Date Package You may ask why you should use PEAR Date instead of PHP s native Unix timestamp-based date and time functions. In fact using PEAR Date means a loss of performance because it is coded in PHP and not C. Additionally you have to understand a new API and learn how to use it. But there are some advantages the main one being that PEAR Date is not based on Unix timestamps and does not suffer from their deficits. A timestamp is used to assign a value in a certain format to a point in time. Unix timestamps count the seconds from 01 01 1970 00 00h GMT and today s computers store it in a signed 32-bit integer number which means it can hold values from minus 2 147 483 648 to 2 147 483 648. This means 01 01 1970 00 00h GMT is represented by an integer value of 0 zero . 01 01 1970 00 01h GMT would therefore be represented by an integer value of 60. The problem with Unix timestamps is that exactly on January 19 2038 at 7 seconds past 3 14 AM GMT the maximum possible integer value is reached. Imagine this as an event similar to the Y2K problem. One second later the counter will carry over and start from - 2 147 483 648. At this point many 32-bit programs all over the world will fail. Some people may say that computers in 2038 will be using at least 64-bit integers. That would be enough to store time Working with Dates representations that go far beyond the age of the universe. Certainly that will