2 Replies Latest reply on Feb 12, 2010 11:34 PM by ralvy

    Date format in Calc

    ralvy

      Title

      Date format in Calc

      Post

      I want to put a date in a window title, fomatted at MM-DD-YY. The default here is MM/DD/YYYY. Is there a simple way to reformat a date string in a calc without breaking it up into pieces and then re-assembling it?

        • 1. Re: Date format in Calc
          comment_1
            

          You could, but then it would it depend on the date format in use not changing - so assembling the the string from the date elements is a better solution.

           

          Anyway, try:

           

          Substitute (
          Replace ( YourDate ; 7 ; 2 ; "" ) ;
          "/" ; "-" )

           

           

          • 2. Re: Date format in Calc
            ralvy
              

            Okay. I ended up just creating this custom function to get a 2-digit year with padded days and months, for any date d:

             

            Right ( "0" & Month ( d ) ; 2 ) & "-" &

            Right ( "0" & Day ( d ) ; 2 ) & "-" &
            Right ( Year ( d ) ; 2 ) )