![]() ![]() We can use this function whenever we need to change a string date to the Unix Timestamp.Getting Started Introduction A simple tutorial Language Reference Basic syntax Types Variables Constants Expressions Operators Control Structures Functions Classes and Objects Namespaces Enumerations Errors Exceptions Fibers Generators Attributes References Explained Predefined Variables Predefined Exceptions Predefined Interfaces and Classes Predefined Attributes Context options and parameters Supported Protocols and Wrappers Security Introduction General considerations Installed as CGI binary Installed as an Apache module Session Security Filesystem Security Database Security Error Reporting User Submitted Data Hiding PHP Keeping Current Features HTTP authentication with PHP Cookies Sessions Dealing with XForms Handling file uploads Using remote files Connection handling Persistent Database Connections Command line usage Garbage Collection DTrace Dynamic Tracing Function Reference Affecting PHP's Behaviour Audio Formats Manipulation Authentication Services Command Line Specific Extensions Compression and Archive Extensions Cryptography Extensions Database Extensions Date and Time Related Extensions File System Related Extensions Human Language and Character Encoding Support Image Processing and Generation Mail Related Extensions Mathematical Extensions Non-Text MIME Output Process Control Extensions Other Basic Extensions Other Services Search Engine Extensions Server Specific Extensions Session Extensions Text Processing Variable and Type Related Extensions Web Services Windows Only Extensions XML Manipulation GUI Extensions Keyboard Shortcuts ? This help j Next menu item k Previous menu item g p Previous man page g n Next man page G Scroll to bottom g g Scroll to top g h Goto homepage g s Goto search ![]() The developer or coder must be aware of the specified string date as a parameter. We can use this strtotime() PHP built-in function whenever required. We can set the time zone to any zone as per the requirements. Also, I am setting the current time zone to Asia/Kolkata so that we can get the date as per the India perspective. ![]() Modify the above program bit more to the human-readable date along with these timestamps. It totally depends on when we run this program. Output at the time of running the above code, you will see the different outputs. As we know changing the string date to the timestamp is the main function of the strtotime() function.Ĭhanging the string date to the actual date. Example #2Ĭhange the dates to the timestamp. We will see the different output as per the current date. Please note that, this output was at the time of writing and running this program. Here we begin with the combing above code as a program and see the output. Given below are the examples mentioned: Example #1 Now, we will use another function to get the human-readable date from this timestamp. This line of code will give us the current timestamp. For this, first, we have to get the current timestamp then we can use the other date function to get the exact date from that timestamp. We can simply follow the syntax of this function and can start using it as per our business requirements.įor Example: If someone wants to know the current date (means which date is going on today) we can use this function. There are no additional plugins or the extensions are required before using this function. This function is one of the basic functions in the PHP language. Till now, various extensions have been made in this function. PHP support this function from very earlier from version 4+. ![]() The second parameter (Now) is an optional one.This parameter is the required one and we can’t skip while working with this function. The first parameter (DateTime) is all about the date/time in the string format. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |