Skip navigation
Adobe Forums User
Currently Being Moderated

Problems converting FILETIME date/time into MM/DD/YYYY format...

Jan 18, 2013 12:30 PM

Tags: #coldfusion #datetime #filetime #utc

Has anyone successfully converted a FILETIME date/time value into a MM/DD/YYYY format using ColdFusion? I am failing drastically, and it seems like an easy conversion.


FILETIME format (details: 85).aspx) is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).


A database I'm working with has such values, and I want to display them in a user-friendly date format within my application.


For example, one record is:




The above number represents the following date and time:


1/22/2013 @ 2:50 PM


Sadly I know this only because the FILETIME value gets written to the database by a third-party application, and within that application I specify it in the MM/DD/YYYY format.


Can anyone offer me some guidance, or better yet has anyone accomplished this already and want to share code?

  • Currently Being Moderated
    Jan 19, 2013 11:39 AM   in reply to Adobe Forums User

    Do it step by step.


    First - divide by something to convert the filetime to seconds.

    Next - do a dateadd to 1601-01-01

    Finally, format the date.


    Note - I did a quick google search and could not find the minimum allowed date in cf.  If it's later than 1601-01-01, it's just a couple of extra steps. 

    Mark as:
  • Currently Being Moderated
    Dec 20, 2013 7:34 AM   in reply to Adobe Forums User

    I did this, on cf9/linux, and it seemed to do the trick:





    Long = createObject("java","java.lang.Long");

    Date = createObject("java","java.util.Date");

    fileTimeToEpoch =

    // take pwdLastSet From Active Directory, it's in filetime

    pwdLastSet = JavaCast("long", Long.parseLong("130292682204519505"));

    // take filetime and turn it into epoch/java - 1970/1/1

    // - converted: jan 1, 1970 00:00 -00

    javaTime = JavaCast("long", pwdLastSet - 116444736000000000);

    // convert to milliseconds

    javaTime = JavaCast("long", javaTime / 10000);

    today = JavaCast("string", Date.init(javaTime));




    <cfdump var="#pwdLastSet#">

    <cfdump var="#javatime#">

    <cfdump var="#today#">

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points