Converting date to string

patcc

Well Known Member
Does anyone know a standard business function that will convert a date to string in the format DDMMYYYY?

I want the string without the separators. The current existing BSFN that I found return a value like DD/MM/YYYY.
I need it without the separators.

Thanks
 
You can use substring function to get rid of the seperators.

All the best.
 
Hi,

Use the substring function and remove the separators.

patcc <[email protected]> wrote: Does anyone know a standard business function that will convert a date to string in the format DDMMYYYY?

I want the string without the separators. The current existing BSFN that I found return a value like DD/MM/YYYY.
I need it without the separators.

Thanks
 
Hi,

Try the BSFN N0701500 - ConvertDateToStringFormatCode. This will yield the result that you expect

For Format Code Parameter here are the valid values

1 MMDDYYYY
2 YYYYMMDD
3 DDMMYYYY
4 MMDDYY
5 YYMMDD
6 DDMMYY

Where:
DD = Day
MM = Month
YY = Year (2-digit)
YYYY = Year (4-digit)

All are left-padded with zeroes

For your case, the format code will be '3'.

Hope this helps.
 
patcc,

Sorry for the lateness of this reply - I have had deadlines.

In addition to the previous suggestions, you could use the Assignment/Expression expression builder to do the following:

FormattedDate = date_day([jdDate])*1000000+date_month([jdDate])*10000+date_year([jdDate])
 
Hi Peter,

[ QUOTE ]
FormattedDate = date_day([jdDate])*1000000+date_month([jdDate])*10000+date_year([jdDate])

[/ QUOTE ]

Just a bit addition:

Presume, FormattedDate is a string variable and at least 8 char long, +

FormattedDate = lpad(date_day([jdDate])*1000000+date_month([jdDate])*10000+date_year([jdDate]),'0' ,8)

This will ad the leading zero, when the day is between 1-9.

Regards,

Zoltán
 
Zoltán,

Well colour me embarrassed!
blush.gif


Thanks - good pick up!

I put it together fairly quickly - may be a little too quickly.

The idea was to demonstrate that a business function was not needed.
 
Does anyone know a standard business function that will convert a date to string in the format DDMMYYYY?

I want the string without the separators. The current existing BSFN that I found return a value like DD/MM/YYYY.
I need it without the separators.

Thanks
can i get the business function with the separator "/"like MM/DD/YYYY
 
Hi @patcc,

There are a lot of BSFN for convert date to string with this format: you can use N0701500 BSFN with format code option 3, you can use B0800208 ,you can use N76B0500, you can use N74Y001, etc. or you can create your own bsfn with date system funtions or with a orchestrator groovy function.

Best regards.
 
Back
Top