React DateTime Format
React DateTime Format npm package is used to format date and time
Authors
Installation
To install react datetime format npm package
npm i react-datetime-format
Usage/Examples
import React from 'react'
import {DateTime} from 'react-datetime-format'
const App = () => {
return (
<DateTime
date="Wed, 31 Jan 2024 08:18:48 +0000"
monthType='short'
showHours={true}
showMinutes={true}
showSeconds={false}
showhour12={true}
/>
)
}
export default App
Result
Result after execution of above code
Jan 31, 2024, 8:18:48 AM
API Reference
DateTime Api Reference
Props | Type | Default | Description |
---|---|---|---|
date |
datetime |
none |
pass the date |
monthType |
string |
short |
short,numeric,long |
showHours |
boolean |
true |
show hours in formatted datetime |
showMinutes |
boolean |
true |
show minutes in formatted datetime |
showSeconds |
boolean |
true |
show seconds in formatted datetime |
showhour12 |
boolean |
true |
show time in 24 or 12 hours |
timeZone |
string |
utc |
show timezone in datetime. e.g - Asia/Kolkata |
lang |
string |
en |
change language of datetime |
Contributing
Contributions are always welcome!
Please adhere to this project's code of conduct
.