Recently, i'm making an application which retrieve facebook posts of a page for a certain date. The issue that i've encountered is, there are some inconsistencies between the post unix time and the displayed date for some posts.
This is an example that i've found:
Created time from JSON reponse : "created_time": "2013-03-09T18:58:20+0000"
Displayed date :March 10, 2013 at 1:58am
The time difference is : 1:58 am - 18: 58 pm = 7 hr
then, for another post:
Created time from JSON reponse : "created_time": "2013-03-09T19:03:17+0000"
Displayed date :March 10, 2013 at 3:03am
The time difference is : 3:03 am - 19: 03 pm = 8 hr
And no, I didn't change my timezone inbetween displaying those two JSON response.
I use graph API and 'since until' parameter with unix timestamp for getting the JSON response.
Is there anyone who can explain this issue?
Thanks in advance! :)
After much more time spending on it..i found this helpful link to implement in my project...
i hope it may helpful to u also..
How to convert Date from facebook api into android app date format
Related
This is my first post here at StackOverflow.
I've tried to search the internet for a while now, but probably because i don't now what to search exactly I can't find the answer online.
I have done a react-native beginners tutorial on how to make an api call and list the results in a flatlist. Everything is working fine, but when I try to add another field that show's the opening hours of that particular day it only works when I hardcode it like this:
<Text style={styles.hours}
numberOfLines={1}>{item.day5}</Text>
This correctly shows the opening hours of Friday, provided by the api. What I would likt though, is to show the opening hours of the actual day of today.
I already managed to calculate the day number and show it in the console by:
let date = new Date();
let dow = date.getDay();
console.log( 'The day is ', dow );
This returns the correct day number. I'm sure it is probably something really simple but I still can't figure out how to use this day number to actually show the current day's opening hours.
Anyone here who can help me out?
Regards, Jelle
My question is simple, How do I add 15 days to a "Field with Data type (Date/Time)" in Access Web App.
There is a Field called Revenue Plan which is a 'Date/Time' Data Type.
and in Billing Due I selected data type 'Calculated' and typed formula mentioned below
Tried :
[RevenuePlan] + 15 //didn't Work//
DateAdd("d",15,[Revenue Plan]) //didn't work//
these both didn't work. Please help me out with this.
Note: Its for Access Web App
Thanks,
Satish
The syntax is slightly different for an Access Web App for the DateAdd function.
The correct syntax should be
=DateAdd(Day,15,[Revenue Plan])
Here is the relevant MSDN link:
MSDN Link
Hello I could find the answer, Its below.
=DateAdd(Day,15,[Revenue Plan])
I'm writing pretty standard RSpec controller tests for my Rails app. One issue I'm running into is simply testing that time values have been persisted in an update action.
In my controller I have:
def update
if #derp.update_attributes(derp_params)
redirect_to #derp, flash: {success: "Updated derp successfully."}
else
render :edit
end
end
#derp has a time attribute of type time. I can test all of its other attributes in the update action as follows:
describe "PATCH #update" do
before do
#attr = {
attribute_1: 5, attribute_2: 6, attribute_3: 7,
time: Time.zone.now
}
end
end
The error I'm getting is:
1) DerpsController logged in PATCH #update updates the derps's attributes
Failure/Error: expect(derp.time).to eq(#attr[:time])
expected: 2015-08-24 18:30:32.096943000 -0400
got: 2000-01-01 18:30:32.000000000 +0000
(compared using ==)
Diff:
## -1,2 +1,2 ##
-2015-08-24 18:30:32 -0400
+2000-01-01 18:30:32 UTC
I've tried using Timecop and also comparing with a to_s or to_i...but every attribute of data type time is completely off as far as the year goes. I've seen a couple posts saying how you can expect it to be within 1 second and how to deal with that, but it looks like my year is completely off?
This can't be that difficult - I just want to test that the controller can take a time sent to it and save it to the database.
What am I missing here?
EDIT: No help here after a couple of days. Let me try to re-iterate what's happening - The date is being stripped because it is a MYSQL type TIME. Notice the 2000-01-01...
let(:time) {'Mon, 24 Aug 2015 23:19:09'}
describe "PATCH #update" do
before do
#attr = {
attribute_1: 5, attribute_2: 6, attribute_3: 7,
time: time.in_time_zone('Eastern Time (US & Canada)').to_datetime
}
end
end
Rather than saving Time.zone.now in the record, define a time variable and update the record with that time so you know which time should be saved in the database. Then, expect to get that time back when you compare.
I ended up doing this:
let(:time) {'01 Jan 2000 16:20:00'}
I really can't find any good explanation as to how or why Rails is storing time as 2000-01-01, or any helper method to format a time like that. I checked the controller params and its actually being sent to the controller with that 2000-01-01 date in it.
Some people say to just use a datetime, but I am truly trying to store a time of the day, so I don't think that makes sense for this use case.
Anyway, I can just use that time variable anywhere in my specs and works.
I'm struggling with datetimes a bit. I'm using asp.net mvc api controllers, a microsoft sql server and AngularJS.
On some button click I'm sending a JSON formatted date to an api-controller. When I post 2015-11-31 00:00 and I look in Fiddler to see what's really posted, I see that the date is formatted as such: 2015-11-30T23:00:00.000Z. (2015-11-31 - 1 hour UTC+01:00 Amsterdam, Berlin, Ber....) This is perfect because there might be a difference between the timezone the sql server might be in and the client. (Or is it?)
The problem is though: When I get the date back from the sql server it doesn't take the client's time zone into account. When I read the DateTime object from the sql server and I return it JSON formatted, the date that's being displayed is: 2015-11-30T23:00:00.000Z. I want it to add 1 hour to be in the timezone where the client is.
My question is: What do I do to get it to keep the timezone in to account while deserializing the JSON string that comes back from my api-controller?
TIA!
Problem turns out to be that when the object is being deserialized, the date property is not of type DateTime. It is of type string. Simply converting it to date by using new Date("2015-11-30T23:00:00.000Z") will do the trick.
I made filter for it:
.filter('from_gmt_to_local_date', [function () {
return function (text) {
return new Date(text);
};
}])
Usage:
{{contract.StartDate | from_gmt_to_local_date | date:'dd-MM-yyyy'}}
Hope this helps anybody.
I'd like to create Trello cards over the Trello API. I'am able to create a card with:
curl -X POST 'https://api.trello.com/1/lists/{LIST_ID}/cards?name=TEST9&due=2014-05-08T08:00:00&key={APP_KEY}&token={TOKEN}'
However, I can't determine my time offset for the due date:
2014-05-08T08:00:00.{OFFSET}
My Timezone is CET (Europe/Berlin), how can I tell Trello this with the time offset?
I could not find it in the documentation, but I am quite sure Trello stores the due dates in UTC. So as the comment already suggests, convert your timestamp to their timezone (which would be UTC).