What is the timezone that Facebook publish the scheduled posts? - facebook-graph-api

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.

Related

Dynamic setting the timestamp fields in superset dashboards

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.

How to stop django postgresql timestramp conversion

When I Insert timestamp into Postgres table in EST (2019-02-21 05:37:46) and in Postgresql table is stores in IST (2019-02-21 16:07:46). I want time to be stored only in EST. Can anyone help me to fix this issue?
In postgres, you can change the default format mask for datetimes using the set n postgres, you can change the default format mask for datetimes using the set datestyle
for more details follow this link
also refer this link
To my knowledge, there is no setting in PostgreSQL that would trim seconds from timestamp literals by default
In general you should handle all datetimes in UTC, because these are absolute timestamps that are always correct. Even if you are only going to have users in the EST time zone use your website, the EST time zone has daylight saving time (DST) in the summer, so you could get buggy behaviour when the time jumps (especially since there is an overlap of one hour when the clock goes back). This means:
Your code should use UTC timestamps to make calculations and pass around
Your database should store UTC datetime (which PostgreSQL does anyway).
You should only transform to a local time zone when presenting the data to the user. This is default behaviour in Django:
USE_TZ = True by default
TIME_ZONE = "America/New_York" to set default time zone, which will take into account DST
So when you're saving a time-aware datetime to the database (in EST say), the database stores it as UTC. When you fetch and display it, Django will show it in the current time zone of the user (EST in your case). When you query the database directly using a tool, PostgreSQL gives back the UTC, correct datetime, but your shell or tool might display it in the local time zone. You can format your query to use a different time zone using the links posted by #c.grey in the other answer.
Read up on the details here

How to make Django store datetimes in UTC but show them in local time in Admin?

What the title says. For simplicity and standardization, I want to store datetimes in UTC timezone, but I want to display them in Admin's local timezone. No matter the settings (TIME_ZONE and USE_TZ), I still have Note: You are x hours ahead of server time when editing my datetimes. I want this note to go away, and the flow to be like:
Type time in local time and click save
Datetime created will be saved in UTC timezone
When I get it from DB by request, it will still be in UTC. Conversion is handled by front end.
If I look at it from admin, it will be in local timezone.

ServiceNow WSDL Timezone needs to change to Users timezone

From Servicenow WSDL, am getting data in some time-zone format.
In Servicenow, there is a option to change the users timezone and get the data as expected . But if we change the timezone in servicenow, it didnt affect for the data which comes through servicenow-WSDL.
How to convert the timezone for the data get through WSDL. Is there any way available in servicenow to automatically convert ? or any idea to develope our own script/code to do the same?
Thanks for your time.
Something to keep in mind when working with SN web services is that by default all time values will come back in UTC time. You can ask for "Display Values" by setting request parameter "displayValue" to either "true" to get back only display values or "all" to get back both display values and direct values.
The Display value for a time field is resolved according to: user timezone preference, then by system timezone.
For example, you could get the WSDL with this request:
https://<instance>.service-now.com/incident.do?WSDL&displayValue=true
and then also include the &displayValue=true on the SOAP request:
https://<instance>.service-now.com/incident.do?SOAP&displayValue=true
Here's a link to the product docs with more info about getting back display values through SOAP: http://wiki.servicenow.com/?title=Direct_Web_Services#Return_Display_Value_for_Reference_Variables
Note the same rules apply when using the REST interface as well, but the parameter is "sysparm_display_value" (http://wiki.servicenow.com/index.php?title=Table_API).
Hope this helps.

Django - can I save DateTime objects that have different timezones in the same column?

If I have a DateTimeField() in a model in my app, can I sometimes store a date time with one timezone and sometimes a different timezone?
Short answer: Yes, you can.
When Django saves the timezone, it saves it as the UTC time in the database. When it goes to display it again in your app, it will look for the settings.TIME_ZONE and apply that time zone. If you need to convert it back to a particular time zone, you will also need to store the string of which time zone it is.
More about: Django Time Zones.