Page 130 - Open Soource Technologies 304.indd
P. 130
Sarabjit Kumar, Lovely Professional University Unit 8: Working with Strings, Date and Time
Unit 8: Working with Strings, Date and Time Notes
CONTENTS
Objectives
8.1 Date Handling
8.2 Retrieving Date and Time Information
8.3 Formatting Date and Time
8.4 Parsing Date Formats
8.5 Strings with PHP
8.6 PHP String Handling Functions
8.7 Accessing String Offsets
8.8 _toString( ) METHOD
8.9 Summary
8.10 Keywords
8.11 Self Assessment Questions
8.12 Review Questions
8.13 Further Reading
Objectives
After studying this unit, you will be able to:
• Understand data handling.
• Discuss retrieving date and time information.
• Explain formatting date and time.
• Understand parsing date formats.
• Explain strings with PHP.
• Discuss accessing string offsets.
• Understand _toString( ) method.
8.1 Date Handling
PHP has a range of functions that handle date and time. Some of these functions work with a
so-called UNIX timestamp, which is the number of seconds since January 1, 1970 at 00:00:00
GMT, the beginning of the UNIX epoch. Because PHP only handles unsigned 32-bit integers
LOVELY PROFESSIONAL UNIVERSITY 125