0

I use Date() function in react native to gave us current time from mobile. and that date I store in firebase (firestore database). Now I want if any one see that date according his location date. like whatsapp,messenger etc messaging date.

for example

June 9, 2022 at 10:31:44 PM UTC+5 date store from pakistan. if any one see that date from turkey so the date show according to UTC+3

rafiulah
  • 149
  • 5
  • if you're storing dates in UTC all you should need is `utcdate.toLocaleString()` check this out https://stackoverflow.com/questions/948532/how-to-convert-a-date-to-utc and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString – Lucretius Jun 09 '22 at 20:50
  • Search [*\[javascript\] how to format a date*](https://stackoverflow.com/search?q=%5Bjavascript%5D+how+to+format+a+date). Consider using [*Intl.DateTimeFormat#formatToParts*](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts) to get the parts and format as required. – RobG Jun 10 '22 at 08:39

0 Answers0