1. In the case of Facebook, when I post a post, it shows how many hours ago I registered, and I want to implement it like this.
Does this mean that when the stored time is loaded, we have to create a function that compares it to the current time?
Or is there another way?
Currently, the server stores "201606231756" in 11 digits.
2. Are there any examples or keywords that have already been implemented?
I am currently using Android and PHP.
android php
Convert the time value stored on the server to milliseconds and use the following API provided by Android DateUtils.
DateUtils.getRelativeTimeSpanString(milliseconds)
The results are printed in the following format: (Results in US format)
3 min. ago, 10:15 AM
Yesterday, 12:20 PM
Dec 12, 4:12 AM
11/14/2007, 8:20 AM
The simplest way is to call a function with one parameter mentioned above, and you can also change the minimum time range (for example, 0 minutes when less than 1 minute) and formatting. Refer to the official document for a detailed description of the parameters.
551 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
549 Understanding How to Configure Google API Key
551 PHP ssh2_scp_send fails to send files as intended
549 Who developed the "avformat-59.dll" that comes with FFmpeg?
542 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.