2 Replies Latest reply on Apr 4, 2012 11:42 AM by amlikhith

    Extracting date

    amlikhith

      Title

      Extracting date

      Post

      I would like to create a number string using various aspect of a date. For eg. I want to extract the day of the date in a 2 digit format ( 03 for 3rd June) along with a 2 digit month format ( 06 for June) and also a 2 digit year format (65 for 1965). I used year(date) but it only returns a 4-digt date, a  day(date) returns one or two digits.

      I want to string these numbers with another unique number. If I use & "" &, can the long string be still calculated as a number of should I used 100000000* dd + 1000000*mm + 10000*yy + nnnn to make sure that the final string is a number?

      Thanks for your responses in advance.

        • 1. Re: Extracting date
          philmodjunk

          Right ( "0" & Day(datefield ) ; 2 ) will add in the leading zero.

          Right ( Year ( datefield ) ; 2 ) will return just the last two digits of the year.

          you can use the concatenation operator (&) to "glue" together the parts of your number and still get a number value if you specify "number" as the return type for your calculation (or use a number field with this expression as an auto-entered calculation).

          Note: I do not recommend using this value as a primary key in your database.

          • 2. Re: Extracting date
            amlikhith

            Fantastic...Thanks Phil. It worked.