Skip to main content
ajithman
Inspiring
June 17, 2009
Answered

Random Time Generation between a Time period in ColdFusion

  • June 17, 2009
  • 2 replies
  • 651 views

Hi,

     I want to generate random time between a certain time period using coldfusion .For example between 1 AM and 4 AM i want to generate random time such as 1:12 AM, 2:30 AM and so on. Please help me to know how i should go about this issue. Thanks.

    This topic has been closed for replies.
    Correct answer Dileep_NR

    Hi,

            Please try this

    http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt261.htm

    2 replies

    Participating Frequently
    June 17, 2009

    I would use DateDiff to get the difference in minutes between the 2

    dates, then use RandRange to get a random number of minutes between 1

    and the previously calculated number of minutes and then add that

    number of minutes to the first date with DateAdd.

    Mack

    Dileep_NR
    Dileep_NRCorrect answer
    Inspiring
    June 17, 2009

    Hi,

            Please try this

    http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt261.htm

    ajithman
    ajithmanAuthor
    Inspiring
    June 18, 2009

    Great..Thanks..