Skip to main content
April 9, 2008
Question

dateFormat()

  • April 9, 2008
  • 1 reply
  • 222 views
Hi,

I'm really puzzled by this. Why does:

<cfset variables.date1 = dateFormat(arguments.scheduleDate, "dd/mm/yyyy") />

Output:
04/10/2008

When it SHOULD be:
10/04/2008

Arguments.scheduleDate is supplied in the correct format:
10/04/2008

In my dateFormat function, I am also specifying that the date should use that Mask, yet it seems to make no difference. This is screwed up! Am I doing something so stupidly wrong here?

I'm using ColdFusion 8

Thanks,
Michael.
    This topic has been closed for replies.

    1 reply

    Inspiring
    April 9, 2008
    Kapitaine wrote:
    > <cfset variables.date1 = dateFormat(arguments.scheduleDate, "dd/mm/yyyy") />
    >
    > Output:
    > 04/10/2008
    >
    > When it SHOULD be:
    > 10/04/2008
    >
    > Arguments.scheduleDate is supplied in the correct format:
    > 10/04/2008

    if that's a string then yes dateFormat() is returning the correct format. all
    the non-LS methods work off the en_US locale (or maybe the OS locale i seem to
    recall that being true at one time) which has a date format of month-day-year.
    use a real datetime object or just use that string.