Php implements the function code to publish information a few minutes ago
- /**
- * How many minutes ago?
- * Site bbs.it-home.org
- */
- Function cTime ($ seconds ){
- If ($ seconds <60 ){
- $ Msg = $ seconds. "seconds ";
- } Elseif ($ seconds <3600 ){
- $ Msg = (int) ($ seconds/60). "minute ";
- } Elseif ($ seconds <86400 ){
- $ Msg = (int) ($ seconds/60/60). "hour ";
- } Else {
- $ Msg = (int) ($ seconds/60/60/24). "day ";
- }
- Return $ msg;
- }
- ?>
2. call method:
- $ Addtime = time ();
- $ Seconds = $ addtime-$ rswy ['addtime'];
- Echo cTime ($ seconds );
- ?>
The above is a simple example provided by the php Tutorial today. >>> Articles you may be interested in: implementing timeline functions in PHP (just five minutes ago) php get time, how many minutes ago example code PHP delete all files created N minutes ago small example php shows according to time, just a few minutes ago, a few hours ago implementation code |