cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Yahya
Level 10

Twitter like Timeago to replace Modified on

Hi,

 

 

For my PowerApps, I wish to display in record view (a Gallery or a form) the Modified On field in the way Twitter states it, such as 

 

  • just now
  • 12 seconds ago
  • 3 minutes ago
  • 2 hours ago
  • 3 days ago
  • 3 weeks ago
  • 6 months ago
  • 2 years ago etc

Any idea where to start? Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Twitter like Timeago to replace Modified on

Hi @Yahya,

 

Could you please share a bit more about your scenario?

Could you please share a bit more about the Modified On field 

Further, do you want to replace the Modified On field value with xx Time ago within a Twitter record displayed with a Gallery or a Display form?

 

Currently, there is no direct way to convert the Modified On field value (a Date Time value) into a xx Time ago format within PowerApps.

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

As an alternative solution, please take a try with the following workaround:7.JPG

 

 

Set the Items property of the Gallery control to following formula:

 

Twitter.SearchTweet("#Azure")

 

Set the Text property of the Label control (Created time field value) to following formula:

 

If(
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Seconds)<60,
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Seconds)&" seconds ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Minutes)<60,
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Minutes)&" minutes ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Hours)<24,
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Hours)&" hours ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Days)<7,
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Days)&" days ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Days)<30,
RoundDown(DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Days)/7,0)&" weeks ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Months)<12,
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Months)&" months ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Years)>1,
RoundDown(DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Years),0)&" years ago"
)

On your side, you should type the following formula:

If(
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Seconds)<60,
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Seconds)&" seconds ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Minutes)<60,
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Minutes)&" minutes ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Hours)<24,
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Hours)&" hours ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Days)<7,
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Days)&" days ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Days)<30,
RoundDown(DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Days)/7,0)&" weeks ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Months)<12,
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Months)&" months ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Years)>1,
RoundDown(DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Years),0)&" years ago"
)

 

Note: The ModifiedOn represents the Modified On field that you mentioned.

 

More details about the DateDiff function in PowerApps, please check the following article:

DateDiff function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Twitter like Timeago to replace Modified on

Hi @Yahya,

 

Could you please share a bit more about your scenario?

Could you please share a bit more about the Modified On field 

Further, do you want to replace the Modified On field value with xx Time ago within a Twitter record displayed with a Gallery or a Display form?

 

Currently, there is no direct way to convert the Modified On field value (a Date Time value) into a xx Time ago format within PowerApps.

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

As an alternative solution, please take a try with the following workaround:7.JPG

 

 

Set the Items property of the Gallery control to following formula:

 

Twitter.SearchTweet("#Azure")

 

Set the Text property of the Label control (Created time field value) to following formula:

 

If(
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Seconds)<60,
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Seconds)&" seconds ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Minutes)<60,
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Minutes)&" minutes ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Hours)<24,
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Hours)&" hours ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Days)<7,
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Days)&" days ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Days)<30,
RoundDown(DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Days)/7,0)&" weeks ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Months)<12,
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Months)&" months ago",
DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Years)>1,
RoundDown(DateDiff(DateTimeValue(ThisItem.CreatedAt),Now(),Years),0)&" years ago"
)

On your side, you should type the following formula:

If(
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Seconds)<60,
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Seconds)&" seconds ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Minutes)<60,
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Minutes)&" minutes ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Hours)<24,
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Hours)&" hours ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Days)<7,
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Days)&" days ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Days)<30,
RoundDown(DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Days)/7,0)&" weeks ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Months)<12,
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Months)&" months ago",
DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Years)>1,
RoundDown(DateDiff(DateTimeValue(ThisItem.ModifiedOn),Now(),Years),0)&" years ago"
)

 

Note: The ModifiedOn represents the Modified On field that you mentioned.

 

More details about the DateDiff function in PowerApps, please check the following article:

DateDiff function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Yahya
Level 10

Re: Twitter like Timeago to replace Modified on

Hi @v-xida-msft, your last code has been the thing i am looking for, thanks tons.

 

see attached image, now Last Modified is much more nicer! I will delete the old fashion now..

 

One little Note, the code worked after remocing DateTimeValue since keeping it has made an error.

 

Thanks again.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,067)