Skip to main content
Inspiring
September 8, 2006
Answered

Date Time Variable

  • September 8, 2006
  • 3 replies
  • 418 views
I am trying to create a new variable using the dateformat function. Everything works and shows like I want it to except for the minute. Any clues?

<CFSET NewFileName = #DateFormat(Now(),"yyyymmddhhns")#>

<cfoutput>#NewFileName#</cfoutput> Results of output 2006090803n37

I do not want any spaces in the output

anthony
    This topic has been closed for replies.
    Correct answer AJBJ
    I changed the code to:

    <CFSET FileDate = #DateFormat(Now(),"yyyymmdd")#>
    <CFSET FileTime = #timeformat(Now(),"hhmms")#>

    and all works fine.

    3 replies

    Inspiring
    September 8, 2006
    Using just dateformat? How do you do that?
    AJBJAuthorCorrect answer
    Inspiring
    September 8, 2006
    I changed the code to:

    <CFSET FileDate = #DateFormat(Now(),"yyyymmdd")#>
    <CFSET FileTime = #timeformat(Now(),"hhmms")#>

    and all works fine.

    Inspiring
    September 8, 2006
    The dateformat formats dates not times, timeformat is for time. You
    probably want something like this:
    #dateformat(now(),"dd/mm/yyyy")# #timeformat(now(),"hh:mm:ss")#

    Note that both use 'mm', but for different values for their formating.
    Inspiring
    September 8, 2006
    The timeformat function comes to mind. How are you doing the hours without it?
    AJBJAuthor
    Inspiring
    September 8, 2006
    the hours and seconds come back find, just not the minute