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 6384413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:46:22+00:00 2026-05-25T02:46:22+00:00

I can use set modDate to the modification date of theFile as string to

  • 0

I can use
set modDate to the modification date of theFile as string to get the last modified date of a file, and
set modDate to the creation date of theFile as string to get the date when the file was created.

Is there anything like last opened date to get the date when the file was last opened?

  • 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-25T02:46:23+00:00Added an answer on May 25, 2026 at 2:46 am

    Yes. There is a UNIX command called kMDItemLastUsedDate that returns the date the target item was last used.

    set the Last_opened_date to (do shell script "mdls -name kMDItemLastUsedDate " & quoted form of the POSIX path of theFile)
    

    However, this command doesn’t return a literal date object. Instead, it returns a date object in ISO 8601:2004 format (YYYY-MM-DD HH:MM:SS) which, if you try to put date before it, you’ll get a syntax error.

    Here is the revised script:

    property months : {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
    
    set the Last_opened_date to date convert_date(do shell script "mdls -name kMDItemLastUsedDate " & quoted form of the POSIX path of theFile)
    
    on convert_date(passed_data)
        set prevTIDs to AppleScript's text item delimiters
        set AppleScript's text item delimiters to space
        set the ISO_date to the first text item of (passed_data as string)
        set AppleScript's text item delimiters to "-"
        set the date_parts to every text item of the ISO_date
        set the_year to the first text item of the date_parts
        set the_month to the second text item of the date_parts
        set the_day to the third text item of the date_parts
        set AppleScript's text item delimiters to space
        set the time_string to the second text item of (passed_data as string)
        set AppleScript's text item delimiters to prevTIDs
        return item (the_month as integer) of months & the_day & ", " & the_year & space & the time_string
    end convert_date
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know you can use set foldcolumn=1 to enable fold column but is there
Such as I can use :set nu as :set number Where can I get
Can the application use set same char in the XON and XOFF? If yes,
How can I use variables to set my timer? I want to control delay
I have set of scripts for doing scripted installs. You can use the scripts
It is convenient for me to use a set. I like how I can
Can I set rails to use mysql with MEMORY as the DB engine? I
My Rails application makes use of Time.zone so that each user can set their
Still working my way around this, but is there any function/command I can use
I need a php script that you can use to set up a online

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.