cancel
Showing results for 
Search instead for 
Did you mean: 

Date Format

former_member200567
Active Contributor
0 Kudos

Hi,

I want to get my date in Date Format (dd-mm-yy).

Regards.

May T

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi May T

If you go to your service Agent creation/modification screen inside the "Application and user management" Work center. there you can choose different date formats.  Choose the one you prefer and save it. It will change it.

Regards

Asad

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello May T,

If you want to see the datre fields on the UI in the requested format follow Asad suggestions.

However, as you post this in the "SAP Cloud Applications Studio" area, I assume you refer to ABSL coding.

Please take a look at the reuse library "Date".

Some examples:

// Create a date from numeric

this.date = Date.Create(20,3,2014);

// Create a date from string

this.date = Date.ParseFromString("20140320");

// Get the day => 20

this.day = this.date.GetDay();

// Get the month => 3

this.month = this.date.GetMonth();

// Get the year => 2014

this.year = this.date.GetYear();

HTH,

   Horst

former_member200567
Active Contributor
0 Kudos

Hi, Horst Schaude.

Thanks.

That's what I need.

Regards,

May T.

rajiv_juarbal
Participant
0 Kudos

Hi Horst,

Is there a function that will format the Date to a specific string format, for example the Date is 2014-08-12 then you want your output in this string format Aug 12 2014? Or do you need to do this manually in your code? like GetMonth(), then if 08, string = "Aug"? and so on and so forth.

Regards,

Rajiv

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Rajiv,

As the textual representation of the "8" as month differs depending on the language there is currently no function available with translates the numeric value to a text.

So you has to do that (the whole stuff)  manually.

Sorry,

   Horst

dhruv_mehta
Active Contributor
0 Kudos

Thanks horst! it worked for me as well

chandansb
Active Contributor
0 Kudos

Hello Horst,

In your example code,

this.day = this.date.GetDay();

// Get the month => 3

how would I achieve fetch the Day for my date?

Example: Input: 06182015, this should return Thursday to me.

Is there any standard function or other way how I will achieve this?

I have also created a separate thread for this query.

Thanks in Advance.

Regards,

Chandan

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Chandan,

As I mentioned in the orther thread, there is no function for getting the weekday in teh reuse libraries.

Sorry,

    Horst

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Chandan,

As mentioned in the other thread:

After a quick look into the ABAP coding of the Reuse Library "Date" I have added a new function "GetWeekday" which will be available with the next release.

HTH,

   Horst

former_member200567
Active Contributor
0 Kudos

Hi Horst,

        That is really cool.

        Looking forward to the next release.

Best Regards

Fred.

Answers (1)

Answers (1)

former_member189209
Active Contributor
0 Kudos

Hi

Use T code- SU3 - go to default tab - change Date format as per your requirement

Thanking you

Mahesh


sunil1101
Advisor
Advisor
0 Kudos

Hi Mahesh

I think we are discussing about how can we change date format in SAP Cloud solution via SAP cloud application studio or  another means.

I don't think we can use T-code in SDK or in SAP cloud solution.

Thanks

sunil