Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Getting the timestamp of a local file - Titanium.Filesystem.File.createTimestamp

Hello Appcelerator Community,

im trying to get the timestamp of the creation date of a File.
But when im using the Function createTimestamp() im getting the error:

Type error:Cannot find function creatTimestamp in object ti.modules.titanium.filesystem FileProxy@43ba7e00

Is something wrong in my code below?

I appreciate any help :)

var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename);
    if ( file.exists() )
    {
        timeStampOfFile = file.createTimestamp();
    }
— asked July 18th 2010 by Marco Schierhorn
  • createtimestamp
  • file
  • filesystem
1 Comment
  • I have the same issue…almost. createTimestamp and modificationTimestamp are both returning 0. This is as of Sep 28, 2010.

    I have updated all the Titanium software..I think. What's the difference between Ti Developer and Ti SDK? When I download either, the file is the same (Titanium Developer.dmg). And I know that the current version of the SDK is 1.4.x but the Ti Developer window shows 1.2.1. Is my SDK out of date?

    — commented September 29th 2010 by Sid K

7 Answers

  • Oddly enough, I'm not getting the error, but when I try, it just seems to only ever return '1'.

    — answered July 18th 2010 by Kosso
    permalink
    0 Comments
  • When i call both variables as properties of Titanium.Filesystem.File:

    modificationTimestamp

    The return result is null or undefined.

    If i use both (modificationTimestamp and createTimestamp) as function calls i always get the error :

    Log :: exception TypeError: Cannot call property modificationTimestamp in object ti.modules.titanium.filesystem.FileProxy@43b89598. It is not a function, it is object.

    — answered July 18th 2010 by Marco Schierhorn
    permalink
    2 Comments
    • try without the double-parentheses () at the end.
      does that work?

      — commented July 18th 2010 by Kosso
    • No, unfortunately not. When im trying to call the methods like
      properties the return result is null or undefined :-(

      — commented July 19th 2010 by Marco Schierhorn
  • Im using a "workaround" now.

    Im storing the Date Value im getting via the Server Response in a text file which is named like the xml file but without the xml ending (replace it with .txt)

    Then i read the content of the text file at the next request.
    But unfortunately im gettting another problem then with setRequestHeader and "If-Modified-Since"…

    — answered July 19th 2010 by Marco Schierhorn
    permalink
    0 Comments
  • Same here…
    not getting any error, but only return '1' for both createTimestamp & modificationTimestamp.

    Bug???

    — answered July 20th 2010 by Joe Maffia
    permalink
    0 Comments
  • It should be resolved in the 1.4.0 Version:

    https://appcelerator.lighthouseapp.com/projects/32238/tickets/1340-getting-the-timestamp-of-a-local-file-titaniumfilesystemfilecreatetimestamp

    — answered July 20th 2010 by Marco Schierhorn
    permalink
    0 Comments
  • I'm having the same problem with both createTimestamp() and modificationTimestamp() returning "1". Any ideas?

    Edit: Am using 1.4 and still getting this.

    — answered July 22nd 2010 by Mark Edmondson
    permalink
    0 Comments
  • Too bad… just upgraded to 1.4.0 and this issue is still there :(

    Still getting "1"

    — answered July 28th 2010 by Joe Maffia
    permalink
    3 Comments
    • Works fine for me now in Android

      — commented July 28th 2010 by Marco Schierhorn
    • I opened a tkt: https://appcelerator.lighthouseapp.com/projects/32238/tickets/1403-createtimestamp-and-modificationtimestamp-returning-1

      — commented July 29th 2010 by Joe Maffia
    • working for me in 1.4.0 on android

      — commented August 3rd 2010 by Oscar Merida
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.