Professional Web Applications Themes

Date Format Problems day and month around the wrongway - Coldfusion - Advanced Techniques

Hi I have a problem with my date format. I am in Australia where we write our date dd/mm/yyyy My Server is in America we they write there date mm/dd/yyyy The value in my database is 01/12/2005 which is how i want it to appear on my page when i use the code: #LSDateFormat(DomainExpirationDate, "dd/mm/yyyy")# the value that appears on the page is 12/01/2005 I have tried the set locale function but it doesn't seem to work. Hope some one can help Thanks Kris...

  1. #1

    Default Date Format Problems day and month around the wrongway

    Hi I have a problem with my date format.
    I am in Australia where we write our date dd/mm/yyyy
    My Server is in America we they write there date mm/dd/yyyy

    The value in my database is 01/12/2005 which is how i want it to appear on my
    page
    when i use the code:
    #LSDateFormat(DomainExpirationDate, "dd/mm/yyyy")#

    the value that appears on the page is 12/01/2005
    I have tried the set locale function but it doesn't seem to work.

    Hope some one can help
    Thanks Kris

    wheres Guest

  2. #2

    Default Re: Date Format Problems day and month around thewrong way

    If the database field is a date or datetime field, the dateformat field will
    always work. Just give it the mask you want.


    Originally posted by: wheres kris
    Hi I have a problem with my date format.
    I am in Australia where we write our date dd/mm/yyyy
    My Server is in America we they write there date mm/dd/yyyy

    The value in my database is 01/12/2005 which is how i want it to appear on my
    page
    when i use the code:
    #LSDateFormat(DomainExpirationDate, "dd/mm/yyyy")#

    the value that appears on the page is 12/01/2005
    I have tried the set locale function but it doesn't seem to work.

    Hope some one can help
    Thanks Kris



    Dan Guest

  3. #3

    Default Re: Date Format Problems day and month around the wrong way

    wheres kris wrote: 

    what db? is the db column datetime? did the db interpret your date
    format correctly from the beginning?
     

    how exactly doesn't it work? this works fine (note the locale syntax is
    cf7/java style).

    <cfscript>
    locales=listToArray("en_US,en_AU,en_GB,th_TH,fr_FR ,pl_PL");
    for (i=1; i LTE arrayLen(locales); i=i+1) {
    setLocale(locales[i]);
    writeoutput("#locales[i]#: #LSdateFormat(now(),'LONG')#<br>");
    }
    </cfscript>
    PaulH Guest

  4. #4

    Default Re: Date Format Problems day and month around thewrong way

    The db is called SummitDatabaseV2.mdb
    The table I am working with is called CustomerWebSiteDatabase
    The db column is Date/Time and the mask is dd/mm/yyyy

    the data is being submitted from the form is getting changed around and
    entered in to the table the wrong way around. eg. form value of 01/02/2003 get
    saved in the column as 02/01/2003

    Hope thats gives you som more info

    wheres Guest

  5. #5

    Default Re: Date Format Problems day and month around the wrong way

    wheres kris wrote: 

    it's access then?
     

    well that's your problem. you'll need to reformat your raw dates from to
    mdy or whatever that access understands correctly (i'm no access
    expert). i guess set your locale to oz, then use lsPDateTime:

    <cfscript>
    setlocale("en_AU"); //try en_US to see the difference
    d="10/12/2005";
    pd=lsPDateTime(d);
    writeoutput("#pd# #lsdateFormat(pd,'LONG')#");
    </cfscript>
    PaulH Guest

Similar Threads

  1. Rounding a Date to the 1st Day of the month
    By Mikey in forum FileMaker
    Replies: 2
    Last Post: February 24th, 03:12 PM
  2. 2 digit Date and month format
    By tony in forum ASP
    Replies: 3
    Last Post: January 30th, 10:48 AM
  3. Replies: 2
    Last Post: October 9th, 07:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139