tejas033
tejas033

Reputation: 175

php mysql set date and time format to users' specific saved timezone



I have a cakephp web application, for which Users can store their respective timezones in Profile table.
The date time stored with record is in UTC format and my date time fields are of VARCHAR(50) type.

I have followed many links amongst which following link helped most but unfortunately didn't work for me http://alvarotrigo.com/blog/timezone-user-configuration-at-cakephp/

My question is:

How can I show date time data depending upon user's Profile timezone. I don't want to make changes in every single fetching/retrieving functions.
Is there anyway to set timezone on application level, so that I will just fetch the Users timezone saved in Profile table and as per that I will set timezone for entire application.

p.s.: 1. the date time fields in my db are of VARCHAR(50) type
2. I would like to save date time in UTC format only

Upvotes: 1

Views: 175

Answers (1)

Rakesh Shewale
Rakesh Shewale

Reputation: 507

Is there anyway to set timezone on application level, so that I will just fetch the Users timezone saved in Profile table and as per that I will set timezone for entire application.

I'm afraid, there's not.

I understand you've mentioned,

I don't want to make changes in every single fetching/retrieving functions.

But when I was in same situation, I used CONVERT_TZ function and modified my functions for fetching data.

see my question here

Upvotes: 1

Related Questions