Start_time for adset - facebook

I can't set starting_time for the adset.
When adset is created, the start date is:
[start_time] => 2016-06-31T13:00:00+0600
which means the date has been generated by my code.
But then, when I read adset by id or observe it in ads manager, the start_date turns to creation date (today's one).
Has anyone faced this trouble?

Your syntax is correct.
but June doesn't have 31th... that's why facebook ignored that input

Related

Handle date and time for different timezones

I'm working on a feature of an app where users can create groups, and each group can have multiple posts. The groups have a start and end date. I'm using Node.js for the backend and PostgreSQL to model the data. The tables look like this (simplified):
CREATE TABLE IF NOT EXISTS public."group"
(
id uuid NOT NULL DEFAULT gen_random_uuid(),
start_date timestamp with time zone NOT NULL,
end_date timestamp with time zone NOT NULL,
owner_id uuid
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL
)
CREATE TABLE IF NOT EXISTS public."post"
(
id uuid NOT NULL DEFAULT gen_random_uuid(),
user_id uuid NOT NULL,
group_id uuid,
created_at timestamp with time zone NOT NULL
)
A user can only post to a specific group once a day and the days in which they post should be recorded (users will be able to see in a "progress calendar" the days in which other people in the group and themselves created a post). Users from different countries may enter the same group.
How should I approach the following problems:
1. Make sure the user doesn't post more than once a day.
Here I could just create a query which checks if the user already
posted on day X. The problem is not knowing the user's
timezone, as the server's timezone is generally used. Should I just
store users' location in the database when they create an account
and use the timezone from there? What if they move? I also thought
about sending a timezone along with the request, but that doesn't
seem like a good idea, as a malicious user could send anything
there.
2. Sync the progress calendars for users with different time zones (e.g. user X from Romania, at 1 AM 22 August, should not see an x-mark in user's Y calendar for the date of 21 August, denoting that user Y hasn't posted on that date, as user Y still has time to post (user Y's date/time is 21 August 6 PM).
3. Not as important as the other 2 - What's a good practice for choosing the start / end date timezone for the group, so that users are not surprised when the group starts / ends. I would go with UTC, but I'm not sure people having UTC-9 and UTC+9 would have a pleasant experience with this.
Just to give an example, timestamp with timezone is represented as 2021-08-17 20:01:00.427+03 in postgres.

How to use a date in a logical condition in Dialogflow CX

I am brand new to Dialogflow CX and am having trouble figuring out how to use a date in a condition. I want to require that a birthdate be entered and be greater than 2000-01-01. I have tried
$intent.params.dob.resolved > 2005-01-01
with and without quotes, but it does not work (always false). I discovered that $intent.params.dob.original > "1/1/01" is resolved as True for all dates, so that is of no help.
Is there a way that works?
To achieve your described use case, you can utilize the condition route or conditional response to return a response according to the condition. Here is a condition you may use:
$intent.params.birthdate.resolved.year > 2000 OR
($intent.params.birthdate.resolved.year = 2000 AND
$intent.params.birthdate.resolved.month > 1) OR
($intent.params.birthdate.resolved.year = 2000 AND
$intent.params.birthdate.resolved.month = 1 AND
$intent.params.birthdate.resolved.day > 1)
Here are examples for your reference:
A. Using the condition in the Conditional Response
B. Using the condition as the Condition Route:
Please note that the birthdate parameter isn’t a string parameter. It is composed of year, month, and day sub-parameters so it is appropriate to utilize them for your use case. Also, note that dates are in ISO-8601 format. For more information, you can refer to the System Entities documentation.
Here are the following results using the condition defined in the conditional response:
When the user enters the same year but not January 1st
When the user enters an invalid date
When the user enters a previous date from 2000-01-01
When the user enters a valid date and latest from 2000-01-01
I guess $intent.params.dob.resolved returns a string, so you need to build a date object firstly, and then compare it with your date.
I encountered a similar problem a few weeks ago. Thing is, Dialogflow actually defaults to string parameters: this means that every value entered as a parameter will (by default) be a string, surrounded by "quotes".
To operate comparisons between dates you'd want to compare integers/numbers, and I think the best way to do so is to take advantage of date system entities.
For example, the system entity
#sys.date
allows you to match a date inserted by the user. Then the best part is, in your condition, you can even manage the date by referencing sub-parts. Here is an example:
if $intent.params.dob.year <= 2005 AND $intent.params.dob.month <= 04:
I'm sorry, you're too young to use this service!
endif
Also, on a side note, "intent parameters" actually become "session parameters" as soon as Dialogflow makes a step from the state in which the parameter was set to another page.
This means that if you set the parameter dob when the user says "I was born on the thirteen of July, 2004" and then you go on to a new page, that parameter will only be accessible as $session.params.dob (and session parameters don't have a "resolved value", they are resolved by default).
So, to recap. Make sure you're using the system date entity. Make conditions for all the parts of the date you need to verify (year, month, day) and try to use your parameter as a session parameter.
I hope at least some of what I wrote can help you, happy bot-building!

I have an article "state" managed by a boolean field, but how can I get the first date (timestamp) when the checkbox was saved as published?

I hope this isn't just a friday brainfart, but here are more details:
I have an article model that only shows to the public when each article is marked as "published" and saved. However, the only timestamp is on create or update, so if someone creates an article on Monday, but publishes Friday, it will still show up as created Monday (thus not at the top of the feed).
Can provide code if needed, but if anyone has a quick thought that would be great. Please ask what code you need to see. Thanks!
I would convert the boolean column published to timestamp.
Set it to now() when published, leave it NULL until published.
If publishing the article was the last update you can sort by the updated_at column.

Formatting dates with FQL

I'm trying to do the following Facebook Query Language query:
https://api.facebook.com/method/fql.query?query=SELECT name FROM user WHERE uid IN (SELECT actor_id FROM stream WHERE app_id = 131580206909839 AND xid = 'daily_thred_production' AND created_time > 2011-03-06 AND created_time < 2011-03-08)
The problem is that the dates aren't being recognized and I can't find any documentation on how to format FQL dates from the Facebook developer section. Any thoughts?
EDIT
I'm doing all of this from the URL with no programming language. I'm just trying to pull one-off statistics for some co-workers.
Epoch time seems to work, thanks! Only problem is that it's only displaying new users that contributed to the stream for the first time. Unfortunately I'm trying to find everyone in the stream, I'll have to look at the stream table more carefully.
Thanks Brian.
They're epoch time (Number of seconds since 00:00:00 Jan 1, 1970 UTC)
You need to convert your dates to epoch time in whatever language you're using.
EDIT: If you need an example, let me know what programming lang you're using.

JIRA JQL searching by date - is there a way of getting Today() (Date) instead of Now() (DateTime)

I am trying to create some Issue Filters in JIRA based on CreateDate.
The only date/time function I can find is Now() and searches relative to that, i.e. "-1d", "-4d" etc.
The only problem with this is that Now() is time specific so there is no way of getting a particular day's created issues.
i.e. Created < Now() AND Created >= "-1d"
when run at 2pm today will show all issues created from 2pm yesterday to 2pm today
when run at 9am tomorrow will show all issues created from 9am today to 9am tomorrow
What I want is to be able to search for all issues created from 00:00 to 23:59 on any day. Is this possible?
Check out startOfDay([offset]). That gets what you are looking for without the pesky time constraints and its built in as of 4.3.x. It also has variants like endOfDay, startOfWeek, startOfMonth, etc.
I run it like this -
created > startOfDay(-0d)
It gives me all issues created today. When you change -0d to -1d, it will give you all issues created yesterday and today.
We're using Jira 6.2 and I use this query:
updatedDate > startOfDay(-1d) AND updatedDate < endOfDay(-1)
to return all of the issues that were updated from the previous day. You can combine with whichever queries you want to return the appropriate issues for the previous day.
Just for the sake of keeping the information up-to-date, with at least JIRA 7.3.0 (maybe older as well) you can explicitly specify the date in multiple formats:
'yyyy/MM/dd HH:mm';
'yyyy-MM-dd HH:mm';
'yyyy/MM/dd';
'yyyy-MM-dd';
period format, e.g. '-5d', '4w 2d'.
Example:
updatedDate > '2018/06/09 0:00' and updatedDate < '2018/06/10 15:00'
In case you want to search for all the issues updated after 9am previous day until today at 9AM, please try: updated >= startOfDay(-15h) and updated <= startOfDay(9h). (explanation: 9AM - 24h/day = -15h)
You can also use updated >= startOfDay(-900m) . where 900m = 15h*60m
Reference: https://confluence.atlassian.com/display/JIRA/Advanced+Searching
A friend who is a JIRA wiz showed me that you can actually pass the filter (escaped) as a jqlQuery parameter to JIRA via URL:
http://hostname/secure/IssueNavigator!executeAdvanced.jspa?clear=true&runQuery=true&jqlQuery=created%3E='2010-05-31%2000:00'%20AND%20created%3C='2010-06-06%2023:59'%20ORDER%20BY%20created%20ASC
I created an ASP.Net page which generates the URLs based on an offset week or month.
Everybody's happy!
You would expect that this is easily possible but that seems not be the case. The only way I see at the moment is to create a user defined JQL function. I never tried this but here is a plug-in:
http://confluence.atlassian.com/display/DEVNET/Plugin+Tutorial+-+Adding+a+JQL+Function+to+JIRA
You might use one of our plugins: the JQL enhancement functions - check out
https://plugins.atlassian.com/plugin/details/22514
There is no interval on day, but we might add it in a next iteration, if you think it is usefull.
Francis.