I just followed instructions on django website https://docs.djangoproject.com/en/dev/ref/class-based-views/generic-date-based/
DayArchiveView was working and TodayArchiveView was showing the date for the next day. I have a 3 hour difference on my time so it's hard to debug it when I can only see the difference at 9 pm at night.
I have USE_TZ = True, and installed pytz. Can I just do {% load tz %} {{ value|localtime }}
From your comments, it seems changing your settings.TIME_ZONE solved the problem. You further wanted to know how to ensure that visitors to your website get the Archives for their current day. This is explained in Django docs as the difference between default timezone and current timezone and in the next section, as wel.
In short, TodayArchiveView will show entries belonging to the same date for all users. This date is the current date based on your settings.TIME_ZONE. This is what you would expect to see in most websites. For e.g. you have an article for Feb 17 in your timezone but a visitor comes from a timezone where it is already Feb 18. They will not be able to see the article in TodayArchiveView even though it was published less than 24 hours ago! Most forums or blogs work in their server time and date.
As the docs explain, there could be conversion to the end user's timezone in views and templates, but it would be confusing if it is done at the model layer.
Related
I'm building few dashboards in Apache superset. All my available timestamp fields are in UTC timezone. (for example fields are, class_start_time & class_end_time).
I want that in the timezone the dashboard is opened all the timestamp fields will be automatically converted.
For example, I'm opening dashboard in Norway , so the UTC data should be converted to CET timezone of Norway.
I have tried to add some value here in Hours offset but its not working.
Can you please guide how we can achieve this.?
Just for reference :
In Kibana dashboards (ELK stack) have feature to automatically convert the timezone into which it is being opened. So I need same thing in Superset.
Normally you would be able to set this with environment variables when you start the program or container. In Apache Superset, this is not possible. There is an ongoing discussion on Github about this issue. One GitHub user posts the problem and workaround, which is far from workable:
Daylight savings causes issues where users have to update datasource
timezone offset for each datasource twice per year.
So the only thing you can do is update the hours offset twice a year. To make matters even worse, if you use Postgresql, this may not even be possible due to a bug as described here.
Hello i want to unpublish blog content after a certain time in drupal
8 how i can do it please help me
Easy peasy, there's a module called Scheduler https://www.drupal.org/project/scheduler
Upon creation you can set any time you want when the content should be unpublished note that this works on CRON execution.
If you don't want to schedule unpublishing time every time you create a blog and you just want to unpublish blog lets say 1 year after publication you can do a form alter and set the default date for a scheduler today's date + 1 year.
Another option is to create a function get_blog_posts where you put a condition to exclude blog posts older than 1 year - if your page is created programmatically.
If you are using views to display you blog post it's even easier - just add filter by authoring date - authored date is less than 1 year.
Let me know which option suits you more and I can give you more details if needed.
Recently we migrated 2013 sites to office 365 using metalogix tool, in one of the site Task list is migrated with all content but the date which is displaying in due date column is one day ahead of the date in source site
Ex: due date is 02/03/2017 in source but in target it is 03/03/2017
are there any teams which faced similar kind of issue??
what might be the fix for this issue??
You have migrated your SP 2013 sites to O365. Your SP 2013 uses your local timezone and O365 uses its timezone. When you migrate SP2013 to O365, it changes the DateTime value(in your local timezone) to O365 timezone. Thats the reason for 1 day ahead.
We're experiencing a similar issue now migrating from a SP 2007 on prem to a SP 2013 on prem. In one list, the dates are "1/01/1900" but the migration fails with Metalogix reporting that "1899-12-31T15:00:00.0000000Z" is an invalid date for those exact fields.
Not sure why at the moment as both servers appear to be set in the same time zone with the same locale.
UPDATE: This is happening on our servers because the SP2007 is set to GMT time whereas the SP2013 is set to UTC time. A default time value in a date/time field entered when the user cannot enter a time component is 12am. So during the migration daylight savings is/isn't taken into account on one of the servers. We've pushed those particular records one day ahead -> when they get migrated they fall back to 01/01/1900 11:00pm -> all we care about is the date so they come across.
I am using Facebook graph API to post on pages
What is the timezone that Facebook publish the scheduled posts in pages?
Is it the admin timezone?
Like this: 1354308243
I don't know about facebook api, but this looks like unix timestamp, which is a number of seconds since epoch and epoch is Jan 1st, 1970 UTC.
What you are dealing with is called timestamp which doesn't mess up things with timezone at all because you calculate the timestamp of your time in timezone and work with it. And whatever time it will be across different parts of the world, it will happen exactly on the specified time.
So instead of saying post it on 7PM, convert the 7PM into timestamp and wotk with that number, like post it on 1354308243. Makes sense?
I had the same problem by setting my php script to use UTC, but timestamp I used created +2 hours time in Facebook. After investigation and checking reference API I found that the user's timezone is offset from UTC
https://developers.facebook.com/tools/explorer/?method=GET&path=me%3Ffields%3Dtimezone&version=v2.10
I saw that my timezone is +2 from UTC time, so I changed it in php script to adjust it. Now it is working OK.
So I assume it relies on admin timezone.
Greetings,
I would like to know if there is any already developed plugin for Django admin to have a better filter for the given date/datetime to filter between the given date interval instead of "today", "last week" etc..
Thanks
You might have a look at my split date-time widget. It provides a text input for the date, which you can attach a JavaScript date picker to, and two drop-downs for hours and minutes. The hours can be 12 or 24 hour based.