Last updated 4 November 2014. Created on 10 April 2010.
Edited by arpitr, batigolix, chadhester, Maksym Kozub. Log in to edit this page.
欢迎各位兄弟 发布技术文章
这里的技术是共享的
Last updated 4 November 2014. Created on 10 April 2010.
Edited by arpitr, batigolix, chadhester, Maksym Kozub. Log in to edit this page.
The local settings can be found at:
Sets the default time zone for the website. Think of this setting as the time zone where the organization is based. When anonymous users visit the site, time fields displayed for them will be converted to this time zone.
Determines if individual users can set their own default time zone. When the user is logged on, this effectively over-rides the above "Default time zone" setting.
Sets the desired first day of week. Mostly affects calendar grid displays, but also affects date-browser output when vieing dates by week. For most US/english sites, this should be set to Sunday. Monday is also frequently used in countries that follow the ISO 8601 date standard. Also, Saturday is common among Gulf Cooperation Council countries. (see http://en.wikipedia.org/wiki/Seven-day_week#Week_number for details)
For USA/Canada/Australia as well as many Middle East countries, week numbers DO NOT follow the ISO-8601 standard, and this option should be unchecked (unchecked is the default behavior).
To fully comply with the ISO-8601 standard for date & time, this option should be checked & First day of week should be set to Monday. This is common for much of Europe & Asia.
Time zone settings can be found at: /admin/content/node-type/[machine_name_of_node-type]/fields/field_[machine_name_of_field]
There are 5 different options for field Time zone handling:
If you start off without a time zone, but then realize that you need one at a later date, it's possible to switch from "No time zone conversion" to "Date's time zone" even though the UI doesn't recommend it.
Perform the switch in the field settings, but once done, execute the following query:UPDATE content_field_foo SET field_foo_timezone = 'UTC'
...where content_field_foo is the table containing the date field data, and field_foo_timezone is the time zone column. For each field instance, this will set a proper time zone where there wasn't one before. Without doing this, your dates will show up with different times depending on the site's time zone and your users' time zones.
You may then edit the time zones to something specific other than UTC on each node's edit page.
Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.
I am running Date 6.x-2.9, and using Date's time zone, but it seems to convert the datetime to UTC on storage into the database, and convert it back to the Date's time zone on redisplay. The above documentation instead says that no conversion is done in the database. Is this in error in the documentation, or when was the functionality changed?
I'm using Date 7.x-2.6, and I agree with @dpatte's comment above. With Date fields that have their timezone handling set to "Date's time zone", it appears that the value stored in the database is UTC, not the local time.
I believe the relevant portion of the documentation above should be re-written as:
Date's time zone - With this option enabled, the date field adds a select box to explicitly specify the time zone for the date entered. When the date is saved to the database, it is converted to UTC and the time zone information is saved with the date. When retrieved from the database, the date is displayed exactly as entered.
I'm 95% sure about this - I'm happy to update the documentation once someone chimes in to confirm that we're on the right track.
Thanks,
-mike
Hi,
I am using Drupal 7.22 version. I added date and time field (pop-up calender) in content type to get input values from user.
The problem is, when content type save, its getting stored correctly in DB but its displayed wrong time value in page.
I already set Default time zone. Still its display wrong time.
Also I am unable to find setting for "No time zone conversion ".
Any one have any idea?
Help appreciated.
Thanks,
In Drupal 6, in addition to adding time zone column I had to add field_foo_offset in order for Calendar Views to show updated nodes.
For example if your Content Type have From and End dates you need to make changes to your nodes like this:
UPDATE `content_type_foo` SET `field_foo_timezone`='UTC';
UPDATE `content_type_foo` SET `field_foo_offset`= '0';
UPDATE `content_type_foo` SET `field_foo_offset2`= '0';
As other mentioned, keep in mind that once you switch from No time zone conversion to Date's time zone, Drupal will treat existing times as they are in UTC and not your local or site time zone. To adjust times as they were entered in UTC you need to add or subtract hours depending on difference between original times and UTC.
Something like this, just make sure to exclude nodes with all day dates:
UPDATE `content_type_foo` SET `field_foo_value` = DATE_SUB(`field_foo_value`, INTERVAL 2 HOUR)