Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

DateFormatter

Convenience methods for formatting date and time. More...

Import Statement: import Felgo 3.0
Inherits:

QtObject

Methods

Detailed Description

This singleton component offers helper methods for formatting date and time values in human-readable pretty formats.

Method Documentation

prettyDateTime( = date)

Returns a human-readable date and time format from the given date parameter (JavaScript Date type) in a relative way, following these rules:

  • If date is within the last or the next 60 seconds, it returns a localized "just now" string
  • If date is within the last or next hour, it returns a string in the format "<x>m" where <x> is the amount of minutes since date
  • If date is within the last or next day, it returns a string in the format "<x>h" where <x> is the amount of hours since date
  • If date is within the last or next week, it returns a string in the format "<x>d" where <x> is the amount of days since date
  • If date is within the last or next month, it returns a string in the format "<x>w" where <x> is the amount of weeks since date
  • For all other date values it returns a localized date/time string in the Locale.ShortFormat format