Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Getting date and time of a file

BradOBradO Posts: 2Member
Hi,

I'm a major newbie to Python (although have a little C under my belt).
I am trying to write a program which will sort files by their last modified date and time (among other things). The problem is I haven't been able to find a function/module that can give me this info. I have searched through the two books I have and as much online info as I could tolerate but have to ask for help. I'm sure it's quite simple if I know the magic word :)

Thanks for any help you can offer

Comments

  • DrostDrost Posts: 24Member
    [b][red]This message was edited by Drost at 2005-1-13 0:28:40[/red][/b][hr]
    : Hi,
    :
    : I'm a major newbie to Python (although have a little C under my belt).
    : I am trying to write a program which will sort files by their last modified date and time (among other things). The problem is I haven't been able to find a function/module that can give me this info. I have searched through the two books I have and as much online info as I could tolerate but have to ask for help. I'm sure it's quite simple if I know the magic word :)
    :
    : Thanks for any help you can offer
    :

    The [b]os.path[/b] module has a [b]getmtime[/b] function which takes a path as parameter and returns its time of last modification (in seconds since the epoch).

    Drost


  • BradOBradO Posts: 2Member
    : [b][red]This message was edited by Drost at 2005-1-13 0:28:40[/red][/b][hr]
    : : Hi,
    : :
    : : I'm a major newbie to Python (although have a little C under my belt).
    : : I am trying to write a program which will sort files by their last modified date and time (among other things). The problem is I haven't been able to find a function/module that can give me this info. I have searched through the two books I have and as much online info as I could tolerate but have to ask for help. I'm sure it's quite simple if I know the magic word :)
    : :
    : : Thanks for any help you can offer
    : :
    :
    : The [b]os.path[/b] module has a [b]getmtime[/b] function which takes a path as parameter and returns its time of last modification (in seconds since the epoch).
    :
    : Drost
    :
    :
    :

    Thanks Drost,

    A quick look through my book reveals it was sitting there under my nose all the time, just lost in the haze of functions. Your help is greatly appreciated.


Sign In or Register to comment.