cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gme-eg
Helper V
Helper V

Exctract month name from date field in powerapps

Please I have a month field which I need it to trigger date field and filled automatically, I used this formula but it is not working, any suggestion how to solve this:

 

Spoiler
= VALUE( MONTH_DataCard3( [Date_DataCard1] ))
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @gme-eg 

 

You are seeing this error because Combobox expects its DefaultSelectedItems to be an array but in this case you are passing a text. This error can be removed using:
 
[Text(DataCardValue7.SelectedDate,"mmmm")]
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

10 REPLIES 10

Hi @gme-eg 

 

To extract the month name from a date type field, you can use the expression as:

If the date is shown on a edit form having the control Date_DataCard1, then use the expression:
Text(Date_DataCard1.SelectedDate,"mmmm")

If you want to retrieve directly from the datasource you can use the expression as:
Text(ThisItem.DateColumnName,"mmmm") -> If inside a gallery or edit form.

Text(LookUp(DataSourceName, Col1 = "Value1").DateColumnName,"mmmm") -> If you want to extract it from the record directly.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255  Thanks a lot I tried but it is not working could you advise what is missing here:

 

Extract Month Name.png

Hey @gme-eg 

 

The issue here is that you are trying to reference the datacard instead of the date picker control. Follow the below steps:

1) Select the date picker inside the datacard and note down the name of control, which is something like: DataCardValue12

2) Pass this control inside the formula

Text(DataCardValue12.SelectedDate,"mmmm")

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255  thanks a lot that's exactly what I need but the formula is not working please see below.

 

Datacard 7.png

Try this:

 

Text(DateTimeValue(Parent.Default), "[$-en-US]mmmm")

 

You can also substitute your data source for Parent.Default

unfortunately this is not working, thanks

I think I see the problem now. You're trying to take a date selected on a page that hasn't been committed and then use that value to drive the behavior of another field to display the month, is that correct?

 

I tried to replicate your config as best I can. Date1 is a datetime dropdown I can populate. Date2 is going to display the month name. 

 

in Date2 I set:

DefaultDate to <datevalue on date1>.selecteddate (for you I think this is datacardvalue7.selecteddate)

then I set format to "mmmm"

month test.jpg

 

 

Hi @gme-eg 

 

You are seeing this error because Combobox expects its DefaultSelectedItems to be an array but in this case you are passing a text. This error can be removed using:
 
[Text(DataCardValue7.SelectedDate,"mmmm")]
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255  thanks a lot it works pretty good

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (4,239)