Post Closed
795
Views
14
Comments
Solved
Convert Date to DD Mon YYYY
Question

Hello,

I have a date (2017-07-10) and i want to display as 07 October 2017.

I do some research and it say to use this function , FormatMonthDayDateFunction

https://www.outsystems.com/help/servicestudio/9.0/Language_Reference/Built_in_Functions/Formatting_functions/FormatMonthDayDate_Function.htm

So in my expression, i put as FormatMonthDayDate(StartDate, " ") and it say unknown function 'FormatMonthDayDate' in expression. May i know what wrong?


2020-02-28 09-46-54
Eduardo Jauch
Solution

Hi,

Use the Builtin function FormatDateTime:

Pass the Date/DateTime in the first parameter and the format in the second "dd MMMM yyyy"

Cheers,
Eduardo Jauch

2017-12-13 08-27-28
Joey Moree

The second parameter is probably the desired format you want.

You probably want something like this:
"dd MMMM yyyy"


Take a look at this page for available formats
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

2016-04-21 20-09-55
J.
 
MVP

Hi,

can you share what you are doing exactly?

I have done it with no problem..


2020-02-28 09-46-54
Eduardo Jauch

J. wrote:

Hi,

can you share what you are doing exactly?

I have done it with no problem..


I think that at least in OutSystems 10, that function is not a Bultin function...
I couldn't find it anyway.

Just found FormatDateTime

Cheers,
Eduardo Jauch

2020-02-28 09-46-54
Eduardo Jauch
Solution

Hi,

Use the Builtin function FormatDateTime:

Pass the Date/DateTime in the first parameter and the format in the second "dd MMMM yyyy"

Cheers,
Eduardo Jauch

2017-12-13 08-27-28
Joey Moree

Oops, unknown function 'FormatMonthDayDate', didn't see that.


Make sure you have actually referenced the function for use in your current module.

2016-04-21 20-09-55
J.
 
MVP

well, there is that :D

I did it in 9.1 and it was still there (since he used the link with 9.0....)


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

It's a function in 9.1 and earlier:

But no longer in 10 and up:

It's listed in the Breaking Changes document for P10:

Side Effects


Built-in Functions

1.

Issue: Date and time format built-in functions were replaced by built-in function FormatDateTime, which allows formatting a Date Time value using the specified format. The upgrade process automatically changes existing modules to keep the previous behavior using built-in function FormatDateTime.

Stack: .NET, Java

Rationale: Maintain only one generic function.

Workaround: None.

Jace Jace: I assume you are on P10. Please check the version number of the things you research, so you won't inadvertently assume it's valid for the latest version.

UserImage.jpg
Jace Jace

Yes, i am using P10. Thanks for pointing out. Will be careful next time when i research. :)

UserImage.jpg
Desanti Nurma

Jace Jace wrote:

Yes, i am using P10. Thanks for pointing out. Will be careful next time when i research. :)


 I Have the same problem to, i want to show just ther year of the date. But i can't cahnge the value can you tell me how? 

Thank you

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Desanti,

FormatDateTime takes a formatting string, as the help information clearly shows:

So it's just a matter of specifying the right format (if you want just the year, use "yyyy"). However, there's also a built-in Function "Year" that returns just the year, which is perhaps better to use:

UserImage.jpg
Desanti Nurma

Kilian Hekhuis wrote:

Hi Desanti,

FormatDateTime takes a formatting string, as the help information clearly shows:

So it's just a matter of specifying the right format (if you want just the year, use "yyyy"). However, there's also a built-in Function "Year" that returns just the year, which is perhaps better to use:


But if I use extract year from date time It will be static, i want it to be dynamic (current year or can select like selecting month in combo box). Can you tell me how? 

2020-02-28 09-46-54
Eduardo Jauch

Desanti Nurma wrote:

Kilian Hekhuis wrote:

Hi Desanti,

FormatDateTime takes a formatting string, as the help information clearly shows:

So it's just a matter of specifying the right format (if you want just the year, use "yyyy"). However, there's also a built-in Function "Year" that returns just the year, which is perhaps better to use:


But if I use extract year from date time It will be static, i want it to be dynamic (current year or can select like selecting month in combo box). Can you tell me how? 

Year(CurrDate())

?


UserImage.jpg
Desanti Nurma

Eduardo Jauch wrote:

Desanti Nurma wrote:

Kilian Hekhuis wrote:

Hi Desanti,

FormatDateTime takes a formatting string, as the help information clearly shows:

So it's just a matter of specifying the right format (if you want just the year, use "yyyy"). However, there's also a built-in Function "Year" that returns just the year, which is perhaps better to use:


But if I use extract year from date time It will be static, i want it to be dynamic (current year or can select like selecting month in combo box). Can you tell me how? 

Year(CurrDate())

?


I tried but it can't. Should I use expression or what? I tried it with text box and fill the default value with Year(CurrDate()) but it doesn't work


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Desanti,

I'm not sure I understand what you want, but I doubt it has to do with date formatting. I'll therefore close this topic, please create a new one describing what you want (with the combo box and whatnot).