datetime(timestamp = now()) formats a timestamp as
YYYY-MM-DD HH:MM — date plus time. Part of
pota/use/time; defaults to now()
when called with no argument.
| Argument | Type | Description |
|---|---|---|
timestamp |
number |
Milliseconds since the epoch. Default now(). |
Returns: string — the date and time as YYYY-MM-DD HH:MM.
Renders the current date and time, then a fixed timestamp.
import { render } from 'pota'
import { datetime } from 'pota/use/time'
function App() {
return (
<ul>
<li>{datetime()}</li>
<li>{datetime(1474075200000)}</li>
</ul>
)
}
render(App)