Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5962765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:09:07+00:00 2026-05-22T19:09:07+00:00

When you choose a file in Finder and hit cmd+i on a Mac, you

  • 0

When you choose a file in Finder and hit cmd+i on a Mac, you get the time the file was (actually) created, and the time it was last modified.

My question is simply: How can I get the actual time of creation from an already existing Mac file with PHP?

Now, having researched the topic, I have read posts that say it is impossible, but in my world “impossible” only means that a thing takes a bit longer to accomplish. Workarounds and hacks are welcomed.

I do not want mtime or ctime related advice, as these only access the last time the file was updated or modified.

Also we’re probably talking Mac only here, but OS independent solutions are also welcome – if they really work on all systems.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:09:08+00:00Added an answer on May 22, 2026 at 7:09 pm

    This script is the best I’ve managed, which wraps the command-line stat tool available on BSD to come up with the inode birthtime attribute.

    // stat.php
    $filename = 'test';
    
    $stat = stat($filename);
    date_default_timezone_set('America/Denver');
    echo strftime("atime: %H:%M:%S\n", $stat['atime']);
    echo strftime("mtime: %H:%M:%S\n", $stat['mtime']);
    echo strftime("ctime: %H:%M:%S\n", $stat['ctime']);
    
    if ($handle = popen('stat -f %B ' . escapeshellarg($filename), 'r')) {
        $btime = trim(fread($handle, 100));
        echo strftime("btime: %H:%M:%S\n", $btime);
        pclose($handle);
    }
    

    The command-line stat tool reads atime, ctime, mtime exactly like PHP’s stat, but comes up with a fourth “inode birth time” parameter. The BSD stat() system call returns st_birthtime when available, but I haven’t found a way to natively expose this to PHP.

    $ touch test # create a file
    $ stat test
    ..."May 30 06:16:22 2011" "May 30 06:16:22 2011" "May 30 06:16:22 2011" "May 30 06:16:11 2011"...
    $ open .
    $ touch test # about one minute later
    $ stat test
    ..."May 30 06:17:04 2011" "May 30 06:17:04 2011" "May 30 06:17:04 2011" "May 30 06:16:11 2011"...
    
    $ php stat.php
    atime: 06:52:48
    mtime: 06:17:04
    ctime: 06:17:04
    btime: 06:16:11
    

    The following command returns a unix timestamp of only the inode birthtime, which is the best I’ve found so far. You can run it with popen() or proc_open()

    $ stat -f %B test
    1306757771
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I edited the app.py file to only use MongoDB through MongoEngine(you get to choose
In the visual studio project settings you can choose a strong name key file
In struts2 upload methods, can I choose where the uploaded file must be saved.
How to Open Download Dialog Where i can choose file save AS Path after
Does anyone know of a complete choose file dialog? Maybe one where you can
Even without a printer-friendly view to print directions, when I choose File->Print in my
I usually: Choose the needed file. Open it in a tab(t character, by default).
I was under the impression that when you double click a file (or choose
I am using this file , to choose color, its a nice dialog, I
Assuming that requestScope.importMe is expecting a path to a JSP file <c:choose> <c:when test=${!empty

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.