cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Kingpin
Kudo Kingpin

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
Highlighted
Community Support
Community Support

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
Highlighted
Community Support
Community Support

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

Highlighted
Kudo Kingpin
Kudo Kingpin

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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (4,535)