php - How to get the hour and the nearest hour -


O people, just a simple question.

How do you get the current hours and closest hours,

now 2:25 pm

Current time 2:00 PM

The nearest time is 2:59 PM (no 3PM , as 2:59 PM .)

Cheers.

You can use the function:

  $ current = Date ("g: 00A"); $ Next = date ("g: 59a");   

If you want real time:

  $ now = date ("G: IA");    

Comments