4 Replies Latest reply: May 15, 2014 10:05 AM by Chickenman _ RSS

    CtoD

    Chickenman _

      This initially seemed straightforward, but I hope someone will break me through this mental block :confused:

       

      I have three fields (columns) representing day, month, year - numeric converted to text and concatonated to give a date and then that field used in CtoD. But the result only yields values where the day and month are two digits.

       

      Don't tell me I have to insert a '0' into the single character values! :eek:

       

      CM

        • CtoD
          Data Kruncher

          Hi CM,

           

          What's your formula?

           

          Month, Day, and Year are all numeric fields in this test, and it works just fine for one and two digit days and/or months:

           

          Ctod(str(Month)str(Day)str(Year),"m/d/y")[/CODE]

            • CtoD
              Chickenman _

              Hi Sandy,

               

              Yep, that works.

               

              I made this more difficult than necessary by first changing the field type of the numeric to character then concatonating in a calculated field then using that field in a calculated CtoD. It got confused along the way I guess.

               

              I appreciate the fast reply!

               

              CM

                • CtoD
                  Data Kruncher

                  You're welcome!

                   

                  To be honest, I didn't expect the above formula to work properly. Whenever I use Str() in combination with other functions, I tend to add an enclosing Trim(), and just to be safe I tend to add a couple of concatenating "/"s, like:

                   

                  Ctod(trim(str(Month))"/"trim(str(Day))"/"trim(str(Year)),"m/d/y")[/CODE]

                   

                  But it seems that Monarch is better able to handle values with CtoD than even I give it credit for, so given the test result above, I may well be overdoing things too. Better safe than sorry, though, right?