Forums > MaxMSP

a display problem in using object [date]

October 4, 2009 | 11:46 pm

Dear users,

Today is 5th ?October 2009.
I can get this information by using object [date].
It produces the date of today as the following:
1052009

However, I want to produce the following:
10052009

How can I reach my wish?

Best,
prko


October 5, 2009 | 2:15 am

Max doesn’t like integers to have a zero in front of them. Thus, as an integer, 04 always gets converted to 4. The only way to do it, is to convert the integer to a symbol "04". Since both the months and the dates can have a zero in front of them, you need to be able to fix both. This example uses [combine] to make a symbol with a leading zero out of integers lower than 10, and then uses another combine to string them all together in the mmddyyyy format you want.

– Pasted Max Patch, click to expand. –

October 5, 2009 | 5:40 am

thanks!


October 5, 2009 | 6:03 am

For an even simpler version, replace the [if] objects with [split 1 9]. Hook ‘em up the same way.


October 5, 2009 | 6:27 am

thanks!
It is amazing!

best,
prko


Viewing 5 posts - 1 through 5 (of 5 total)