Search the Community
Showing results for tags 'timezone'.
-
As we close out 2025, I'm pleased to share a new module that I've been using in production: FieldtypeTimezone / InputfieldTimezone. π― What It Does A straightforward timezone fieldtype that handles the complexity of timezones automatically - no configuration needed, just install and use. Key Features: Dynamic UTC offsets - automatically calculates current offsets with DST support Simple format - displays as "Country β City (UTC+X)" Intelligent caching - 24-hour cache for optimal performance Production-ready - strict validation at all levels Complete coverage - all major world timezones included π‘ Why I Built This Working on global websites (wine shop, news portal), I needed a reliable way to handle user timezones without complexity. The module automatically adjusts UTC offsets for DST: America/New_York: UTC-5 in winter, UTC-4 in summer Europe/London: UTC+0 in winter, UTC+1 in summer π Basic Usage <?php // Display date in a nice English format $timezone = $page->tz; // e.g., "America/New_York" if ($timezone) { $tz = new \DateTimeZone($timezone); $datetime = new \DateTime('now', $tz); echo $datetime->format('F j, Y \a\t g:i A T'); } ?> Perfect for: User profiles with timezone preferences Event calendars with automatic time conversion Global applications requiring accurate time display Any site serving users across multiple timezones π Requirements ProcessWire 3.0.0+ PHP 8.1+ π¦ Installation GitHub: https://github.com/mxmsmnv/FieldtypeTimezone cd /path/to/processwire/site/modules/ git clone https://github.com/mxmsmnv/FieldtypeTimezone.git Or download and extract to /site/modules/FieldtypeTimezone/ Then install via Modules β Site β FieldtypeTimezone π Documentation Full documentation with practical examples, API methods, and advanced usage scenarios is available in the GitHub repository. π€ Feedback Welcome The module has been tested in production on several sites, but I'd appreciate any feedback, suggestions, or bug reports from the community. Happy New Year to the ProcessWire community! π
-
Hello, the hoster of our client migrated their servers and now I get this warning in the back-end when logging in: I know this topic was already answered in two other threads. I tried out this solution: At first this seemed to be a simple solution, but then I noticed that pages in the page tree were blank. So this seems to be no ideal solution. I tried to find out the name of the new timezone, the current name ist "Berlin/Europe", but how do you find out the exact name? It seems to be some Pacific timezone. I tried out different websites to find out the timezone name, but with no luck yet. π In this thread are some solutions with SQL commands and hooks. But I am not experienced with SQL and don't want to touch the database: Can somebody please recommend me a simple solution to get rid of this warning? Regards, Andreas
-
Hi all, I've just noticed on the site that I'm developing, that the time is wrong for the $page->created field. In the config.php file I have the timezone set to $config->timezone = 'Europe/London'; The date is correct, but the time is out. It is currently 21.35 where I am, but the time that's displayed in the info box for the page (in the admin) is 14:35. So it's a few hours out, and I can't understand why? Any suggestions welcome.
-
I installed a module and noticed that the "Installed Date" in Module Information showed "2 hours from now". I also noticed that after I modified a page, the "Last Modified Date" showed the date and time, plus in parenthesis "2 hours from now". I am in Eastern (New York) time, the server is in Central (Dallas) time, and the physical location of the entity for whom I built the site in in Pacific (Los Angeles) time. When I installed the site, I changed the timezone to Los Angeles (if I recall correctly, it defaulted to Dallas), so now in my config file I have: $config->timezone = 'America/Los_Angeles'; My question is twofold: 1. Should $config->timezone correspond to the servers timezone, or my (or the client's) timezone? 2. Is there any problem if it's set incorrectly? Thanks!! PW 3.0.42
-
<link type='text/css' href='/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.css?v=103' rel='stylesheet' /> <link type='text/css' href='/wire/modules/Inputfield/InputfieldCheckboxes/InputfieldCheckboxes.css?v=100' rel='stylesheet' /> <link type='text/css' href='/wire/templates-admin/styles/inputfields.css' rel='stylesheet' /> <link type='text/css' href='/wire/templates-admin/styles/JqueryUI/JqueryUI.css' rel='stylesheet' /> <link type='text/css' href='/wire/modules/Jquery/JqueryWireTabs/JqueryWireTabs.css?v=103' rel='stylesheet' /> <script type='text/javascript' src='/wire/modules/Jquery/JqueryCore/JqueryCore.js?v=162'></script> <script type='text/javascript' src='/wire/modules/Jquery/JqueryUI/JqueryUI.js?v=180'></script> <script type='text/javascript' src='/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.js?v=103'></script> <script type='text/javascript' src='/wire/modules/Inputfield/InputfieldDatetime/timepicker/jquery-ui-timepicker-addon.js'></script> <?php // create a selctor for Date and time $field = $modules->get("InputfieldDatetime"); $field->label = "Preferred appointment day"; $field->attr("id+name","preferredday"); $field->required = 1; $field->datepicker = 1; // picker on Click $field->dateInputFormat = 'd/m/Y'; $field->timeInputFormat = 'g:ia'; $form->append($field); ?> sorry in advance as I'm on into my second week of learning PHP and PW if my coding is bad to say the least The issue I'm have is that with the above code I'm getting "Millisecond", "Microsecond","Time Zone" and "Now" Button and would like to not show these option. also as a stretch and pushing the limits of asking for help changing the time to be a select box from 7:00AM to 4:00PM broken into half hour blocks I've attached the whole file if it helps. Finally I have to say it may be only a week or 2 but the support and information I have been able to find in these forums has made the process this far an easy ride Tenant Form.php
- 1 reply
-
- InputfieldDatetime
- Timezone
-
(and 2 more)
Tagged with:
-
Hi there, can't seem to get my head around handling user timezones the right way and hope to get some feedback from people more knowledgeable than me. My scenario: Users can set publishing date/time for pages they create through a frontend form. These should be saved in the users' timezone. I have a date field for publishing time. PW saves dates as unix timestamps to the DB. For conversion of the date/time to the timestamp PW uses the default server time zone setting (in my case Europe/Berln). Now when a user in timezone America/New_York creates a page and sets the publishing date, it will be converted to a timestamp using the server timezone Europe/Berlin and saved to the DB. Later the user checks if his page is being published at the set time in New York. But it will be published at the wrong time because the user is in a different timezone. I assume it would be best to convert the publishing date/time to a timestamp using the user timezone and save that to the DB. Am I right here? How would I accomplish that? I found date_default_timezone_set. Can I simply use this to set the user timezone before I save values, like date_default_timezone_set($userTimezone); // where $userTimezone is a string like "America/New_York" $editpage->of(false); foreach($adform as $field) { // loop through all fields and save them if(in_array($field->name, $ignorefields)) continue; $editpage->set($field->name, $field->value); } $editpage->of(true); date_default_timezone_set($config->timezone); // do I have to set it back to server timezone here?
-
hello forum i have insert a datetime field and it shows me the correct day with wrong hour, i changed the $config->timezone inside site/config.php from America/New_York to Europe/Athens as seen here but then i get (31 December 1969 7:00 pm) i have try and with other europe citys and i get the same date i do something wrong? thanks.