Formatting date field

I have a two date fields called DateFrom and DateTo.
In the header I need it in mm/yyyy form like 02/2009 – 03/2009.

I tried creating a formula
ToText(datepart(“m”,{?@DateFrom}),0) + “/” + ToText(datepart(“yyyy”,{?@DateFrom}),0)
+" - "+ToText(datepart(“m”,{?@Dateto}),0) + “/” + ToText(datepart(“yyyy”,{?@Dateto}),0)
But this gives me 02/2,009 – 03/2,009.

Can anybody help me?


prince (BOB member since 2007-11-08)

Is there a reason why you can’t just format the date field?

Right click the field -> Format field -> go to Date tab -> Select Customize

Otherwise, don’t forget that when you are converting a number to text you need the following format to remove the comma:

totext(,0,"")

Note the third argument is “”. This denotes what should be used as a thousands separater.

So for your year part it would be:

ToText(datepart(“yyyy”,{?@DateFrom}),0,"")


jesibl (BOB member since 2008-11-18)

Try this.

cstr({Date From},'MM/yyyy')&' - '&cstr({Date To},'MM/yyyy')

AnthonyJ :philippines: (BOB member since 2006-06-30)

Thank you so much, it worked.


prince (BOB member since 2007-11-08)

Change the date format of the related objects to the required format in universe itself. :slight_smile:

Regards,
RK


Rakesh_K :india: (BOB member since 2007-12-11)