1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

FYI: UNIX time or timestamp in ColdFusion

Discussion in 'Programming' started by garpenholm, Oct 11, 2007.

  1. #1
    UNIX time format in ColdFusion
    -----------------------------------------------------------------------
    I saw that this question was up in the PHP forum, so I also give an answer for ColdFusion:

    <CFSET unix_time = DateDiff("s", CreateDate(1970,1,1), Now()) />
    SEMrush
    You need to change Now() to a ODBC DateTime variable like:

    <CFSET Your_Date = CreateDate (2006, 10, 05)>
    <CFSET Your_ODBCDate = CreateODBCDateTime(Your_Date)>
    <CFSET unix_time = DateDiff("s", CreateDate(1970,1,1), Your_ODBCDate) />
     
    garpenholm, Oct 11, 2007 IP
    SEMrush
  2. cfStarlight

    cfStarlight Peon

    Messages:
    398
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    garpenholm,

    Thanks for posting it. I was going to suggest you submit it to cflib.org, but just noticed they do have a similar function :)

    http://cflib.org/udf.cfm?ID=293
     
    cfStarlight, Oct 11, 2007 IP