TAILIEUCHUNG - Phát triển web với PHP và MySQL - p 43

Managing the Date and Time CHAPTER 18 395 you can pass in 0s to the hour, minute, and second parameters. You can, however, leave out values from the right side of the parameter list. If you leave the parameters blank, they will be set to the current values. Hence a call such as $timestamp = mktime(); will return the UNIX time stamp for the current date and time. You could, of course, also get this by calling $timestamp = date(“U”); You can pass in a 2- or 4-digit year to mktime(). Two-digit values from 0 to 69 will be interpreted as the years 2000 to 2069,. | Managing the Date and Time 395 Chapter 18 you can pass in 0s to the hour minute and second parameters. You can however leave out values from the right side of the parameter list. If you leave the parameters blank they will be set to the current values. Hence a call such as timestamp mktime will return the UNIX time stamp for the current date and time. You could of course also get this by calling timestamp date U You can pass in a 2- or 4-digit year to mktime . Two-digit values from 0 to 69 will be interpreted as the years 2000 to 2069 and values from 70 to 99 will be interpreted as 1970 to 1999. Using the getdate Function Another date-determining function you might find useful is the getdate function. This function has the following prototype array getdate int timestamp It takes a time stamp as parameter and returns an associative array representing the parts of that date and time as shown in Table . 18 Table Associative Array Key-Value Pairs from getdate Function Key Value seconds Seconds numeric minutes Minutes numeric hours Hours numeric mday Day of the month numeric wday Day of the week numeric mon Month numeric year Year numeric yday Day of the year numeric weekday Day of the week full text format month Month full text format Managing the Date and Time 396 Part Title Part IV Validating Dates You can use the checkdate function to check whether a date is valid. This is especially useful for checking user input dates. The checkdate function has the following prototype int checkdate int month int day int year It will check whether the year is a valid integer between 0 and 32767 whether the month is an integer between 1 and 12 and whether the day given exists in that particular month. The function takes leap years into consideration. For example checkdate 9 18 1972 will return true while checkdate 9 31 2000 will not. Converting Between PHP and MySQL Date Formats Dates and times in MySQL are retrieved in a slightly different way than you might expect. Times

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.