Reputation: 436
I am using moment.js to get the current date, however I am having a problem about the date formatting and I don't have any idea on how to customize it since I am just new using it.
By the way I used this.
moment().format('LLLL');
My expected output is:
Mmmm-dd-yyyy hh:mmAM/PM (Timezone) or just like Sep-19-2020 3:00AM (GMT +8)
Is the any other way to achieve this?
Upvotes: 2
Views: 3937
Reputation: 108
moment().locale('tr').format("MMM-DD-yyyy h:mA [(GMT] Z[)]")
moment().locale('en_US').format("MMM-DD-yyyy h:mA [(GMT] Z[)]")
If you want to use locale in React Native.
instead
import moment from 'moment'
you should use this
import 'moment/min/moment-with-locales'
moment.locale('tr');
moment().format("MMM-DD-yyyy h:mA [(GMT] Z[)]");
Upvotes: 5