8 Replies Latest reply on Jan 20, 2009 8:49 AM by Günter Schenk

    Add day of week to mysql datetime output?

    benblue Level 1
      Hello,

      i want to add the day of week to my db output - now i get "12/12/08 5:p" and i am hoping to get "sunday 12/12/08 5:p".

      Any advice? I'd like not to change my input system, rather just translate the output.

      Also, is it possible to affect the space between the date and time in my example? Add a coma or space, etc. .
      The db column is set to datetime.

      Thanks!
      Ben
        • 1. Re: Add day of week to mysql datetime output?
          benblue Level 1
          so i tried what i read here: http://us.php.net/date, and it doesnt work as expected. i may be missing something. i tried adding "l" in the screen date format in kt_config.inc.php, but it just adds the letter l with my date.

          $KT_db_date_format = "yyyy-mm-dd";
          $KT_db_time_format = "HH:mm:ss";
          $KT_screen_date_format = "l m-d-yy";
          $KT_screen_time_format = "h:mm t";

          any ideas? i just want to echo the day of the week, appended to my date..
          best,
          ben
          • 2. Re: Add day of week to mysql datetime output?
            Günter Schenk Level 4
            Hi Ben,

            ------
            i tried adding "l" in the screen date format in kt_config.inc.php, but it just adds the letter l with my date
            -----

            the screen date/time values defined in this file are getting parsed by some function in the file "includes/common/KT_functions.inc.php" -- and those parsing functions limited to the chosen yyyy-mm-dd (respectively HH:mm:ss) format, that is, any other value (e.g. "l") is getting ignored by the parser and will not become "translated" to anything.

            Cheers,
            Günter Schenk
            Adobe Community Expert, Dreamweaver
            • 3. Re: Add day of week to mysql datetime output?
              Level 1
              What sort of page are you trying to display it on? Form, List, something else?

              How are you getting the original date value from the database?

              When are you trying to add the formatted string to the page - on display, when the value is entered on a form ???
              • 4. Re: Add day of week to mysql datetime output?
                benblue Level 1
                Its a just bindings dragged from the binding window into table cells, and each has the "Developer toolbox datetime" format applied in that same bindings window.

                the original date value from the bd comes thru the recordsets / bindings.

                yes i want to add the formatted string on display, but i realized i can enter it beforehand, as a totally seperate column into the db, if i have to.

                i really dont want to though, as there are many tables that i would have to rework to fit in this new field.

                the application is, the site's owner will enter the data that will be displayed via a dynamic list / form. its not from users, or on the site - the entry point. this app is solely for the purpose of administrating his schedule(s).
                • 5. Re: Add day of week to mysql datetime output?
                  Level 1
                  see http://www.php.net/manual/en/function.date.php

                  $futuredate = mktime(0, 0, 0, date("m") , date("d")+10, date("Y"));
                  echo date('l jS \of F Y h:i:s A',$futuredate);
                  ?>
                  • 6. Re: Add day of week to mysql datetime output?
                    Level 1
                    ben,

                    If you haven't got this working yet can you post your recordset and specify the name of the date field from your database table.

                    Shane
                    • 7. Re: Add day of week to mysql datetime output?
                      I am having the same problem. I really want to display the date in different formats through the document, but in pulling it from MYSQL we only get the option that we set up in the one configuration. That really is not good enough and I would like the ability to change how it displays in different areas. Here is the code that pulls it and it shows as m/d/y hh:mm:ss t.



                      I would love to show two formats at this time on one page. m/d/y h:mm tt and Saturday June 3, 2007 at 10 AM.

                      How can I do this?
                      • 8. Re: Add day of week to mysql datetime output?
                        Günter Schenk Level 4
                        Hi Vann,

                        have a look at the various date formatting options of MYSQL´s DATE_FORMAT function:

                        http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format

                        Cheers,
                        Günter Schenk
                        Adobe Community Expert, Dreamweaver