Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.
Linked Related Hot Network Questions. Stack Overflow works best with JavaScript enabled. Accept all cookies Customize settings.
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Set the date and time for a file Ask Question.
Asked 9 years, 10 months ago. Active 2 years, 3 months ago. Viewed 11k times. Thanks in advance! Airikr Airikr 5, 12 12 gold badges 51 51 silver badges bronze badges. Do you want it to be part of the image or a record in the db? I want it to be a part of the image. For example: you single click on the file in Computer and reads the details about the file.
I want to set the date and time that's shows in that information, when it was created. That is not PHP's job. That is the file's modified time.
Your operating system should be creating that metadata in the image file itself. If you want to get that information within PHP, you can use filemtime : php. Take a look at this, it might help: us2.
I didn't right clicked on the file and readed the information in Properties :P But does any operating systems add the created date and time for an uploaded file? Note : Note that time resolution may differ from one file system to another.
Note : The results of this function are cached. See clearstatcache for more details. As of PHP 5. Refer to Supported Protocols and Wrappers to determine which wrappers support stat family of functionality.
Submit a Pull Request Report a Bug. Parameters filename Path to the file. Return Values Returns the time the file was last modified, or false on failure.
Notes Note : Note that time resolution may differ from one file system to another. Tip As of PHP 5. See Also filectime - Gets inode change time of file stat - Gives information about a file touch - Sets access and modification time of file getlastmod - Gets time of last page modification. This is a very handy function for dealing with browser caching. For example, say you have a stylesheet and you want to make sure everyone has the most recent version.
You could rename it every time you edit it, but that would be a pain in the ass. This comes in handy when you want just one 'last updated' message on the frontpage of your website and still taking all files of your website into account. Regards, Frank Keijzers. For example the command "touch directory" updates the timestamp of a directory without file creation.
Also file removal will update the timestamp of a directory.
0コメント