11 Replies Latest reply on Sep 30, 2013 4:02 AM by Eugene Tyson

    Changing date format (find/change?)

    Jakras Level 1

      Hello, I have little bit tricky question.

       

      I have document full of dates:

      01.01.2013

      02.01.2013

      05.01.2013

      ...

       

      And i want to change all these dates just to:

      01. Mon

      02. Tue

      05. Fri

      ...

       

      Is there a possibility to do that within Indesign? Thank you for your answers.

        • 1. Re: Changing date format (find/change?)
          Salah Fadlabi Level 5

          Try: Grep Find and Change

          Find What: (01).(\d{2}).(\d{4})

          Change To: $1. Mon

           

          then repeat this process for the other dates, (like (02) ($1. Tue)) hope this would help.

          • 2. Re: Changing date format (find/change?)
            Peter Spier Most Valuable Participant (Moderator)

            That string will probably work, but technically it would be cleaner to properly identify the dots (as the are, they're wildcards for anay character) by "escaping" them.

             

            If all of your dates are or the format xx.01.2103 I'd also specifically use the 01.2013, like this:

             

            Find (01\.)(01\.2018) and change to $1 Mon (and repeat withthe six other options for the other days). If it isn't consistently 01.2013, then using the wildcards, (01\.)(\d{2}\.\d{4}) would make sense, but I wonder if then the initial 01s would all correspond to Mondays.

            • 3. Re: Changing date format (find/change?)
              Sandee Cohen Adobe Community Professional

              I think Salah and Peter have mis-understood the question. (Or I have mis-understood it.)

               

              The poster doesn't have just seven dates. He has a lot of dates. And he wants InDesign to be able to know if each one is a Monday, a Tuesday, etc.

               

              InDesign knows that a certain date is a Monday, a Tuesday, etc. if you use Text Variables. But you can't just enter the date and have ID create the proper day of the week. It's all tied into the modification, creation, or output date.

               

              In this case OrcusDei would do better with a script that knows the date/days for all the years he is dealing with. That's 365 entries per year. Then the script could do the Find/Change accordingly.

               

              I found a web page that gives all those date/days for many years but I suspect there is a formula that could be used.

               

              But I don't think a Simple GREP change can do it.

              • 4. Re: Changing date format (find/change?)
                TᴀW Adobe Community Professional & MVP

                Here's a one-liner that gives you the day of any date you like

                 

                alert(String(new Date(prompt("Please type a date in a sensible format

                (e.g. 10 Dec 1901)"))).slice(0,3), "The day is...");

                 

                Ariel

                • 5. Re: Changing date format (find/change?)
                  TᴀW Adobe Community Professional & MVP

                  Hmm, I suspect that the previous one liner may be dependent on

                  individual operating system settings. So here's a revised one-liner. You

                  can fill in the days however you like (any language etc.) or leave as is:

                   

                  alert(["Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat"][(new

                  Date(prompt("Please type a date in a sensible format (e.g. 10 Dec

                  1901)", new Date()))).getDay()], "The day is...");

                   

                  Ariel

                  • 6. Re: Changing date format (find/change?)
                    Jakras Level 1

                    Sandee, you got it exactly right. That's very unfortunate. It's pretty simple data formating and i'm surprised InDesign can't nativly do that O_O

                     

                    I had to take all these dates into MS Excel and change it there, then paste it back into indesign. Fortunetely my data were previously in Google Spreadsheet table, but for other people that would need to format dates, woah, this is really surprising.

                    • 7. Re: Changing date format (find/change?)
                      Jakras Level 1

                      Hello Ariel and thank you for your Answer. Unfortunately, i absolutely doesn't have a clue what to do with this. I'm lame in scripting :-)

                      • 8. Re: Changing date format (find/change?)
                        TᴀW Adobe Community Professional & MVP

                        It wasn't a direct answer to your question. It's just a short script

                        that shows how easy it is to get the day of the week for any

                        user-provided date. So it could be used as the basis of a slightly

                        longer script that would find all the dates in your document, figure out

                        what day they refer to, and change the date to the format you requested.

                         

                        To try the script just open the ExtendScript Toolkit software that is

                        installed on your computer along with InDesign; copy/paste the one line

                        script into the main Window, and hit F5 or click on the Play icon.

                         

                        Ariel

                        • 9. Re: Changing date format (find/change?)
                          Eugene Tyson Adobe Community Professional & MVP

                          OrcusDei wrote:

                           

                          Sandee, you got it exactly right. That's very unfortunate. It's pretty simple data formating and i'm surprised InDesign can't nativly do that O_O

                           

                          InDesign is not a data formating tool - nor is it a word processor. It's a layout tool for creating print/web ready documentation.

                           

                          It can do a lot of things - but it can't reformat your data.

                           

                           

                          I would have done the same as you did - but I would have added a blank character style(create a char style based on None and don't select any options) to the numbers and created an index.

                           

                          http://www.kahrel.plus.com/indesign/index_charstyles.html

                           

                           

                          Brought that to Excel and converted the text to the way it was supposed.

                           

                          Then prepare the "FindChangebyList" in the scripts panel.

                           

                          http://indesignsecrets.com/find-change-scripting-goodness.php

                          • 10. Re: Changing date format (find/change?)
                            Willi Adelberger Most Valuable Participant

                            InDesign is recognizing such data only in 2 cases: First, when you use text variables, the formatting is used upon the settings of the variable AND of the text language where this variable is use and upon import of table data, which should also respect the language of the paragraph, but not always does.

                            Problem with MS Office is that there are always problems with any other language than English. You might get a mess when you import data from Excel to InDesign if you are not using the US version. The workaround is format any content from Excel to text, so no data are imported, but text columns.

                            • 11. Re: Changing date format (find/change?)
                              Eugene Tyson Adobe Community Professional & MVP

                              Either way - InDesign can't do it natively - so you need some 3rd party option, whether it's a script or using alternative software.

                               

                              InDesign was never designed to offer reformating of text that database and spreadsheet software can.