How can I convert time in ms to yyyy-MM-dd'T'HH:mm:ss.SSS'Z' format? - facebook

I write mobile application with Corona SDK that interacts with Facebook.
On user's Facebook login I receive "expiration of access token" from Facebook in ms.
I want to send it to Parse.com (SAAS) in the yyyy-MM-dd'T'HH:mm:ss.SSS'Z' date format.
How can I do it?

date = os.date("!%Y-%m-%dT%H:%m:%S.000Z")
You'll have to leave the milliseconds as 0, because you can't get those from os.date. Also the ! at the start is required to get UTC time (as opposed to local time), which is what the Z at the end signifies.
More info.

The LuaDate library apt for Date Manipulationss
http://luaforge.net/projects/date/
It is very easy to use, and it is documented well!
You can download it from here
http://files.luaforge.net/releases/date/date
There may be other easier ways as well.

Related

How does Facebook convert fbclid to _fbc

I need the _fbc value but not from the cookie, so I need a way to convert the fbclid to the _fbc value and store it somewhere else to trigger the API conversion, but due to the coming changes to iOS I can no longer rely on the cookie so what is fbclid using to encrypt to the _fbc?
I've been trying to research on how to get the value but I have not found anything yet.
According to the Facebook dev docs: https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/fbp-and-fbc
If you don't have the pixel installed or the _fbc cookie isn't available, then the fbc value is a combination of the version, subdomain index, the UNIX timestamp in milliseconds, and the fbclid value:
fb.1.timestamp.fbclid-value

Google Drive Sdk- Audio & Video Streaming in iOS Application

Hi Google Drive Staff,
I have tried to stream video files from Google Drive(Without Downloading). But I gets alerts that Sign In. I have went thoroughly with Dr. Edit sample App but i did not found any solution. I tried with downloadUrl , embedLink, webContentLink, alternateLink. All gives message to sign In. When i tried with exportsLinks i get a Null Message. What is the problem Here. If U have any suggestion Please Let me Know...
I have tried with Google Drive for iOS in iPod, there we can stream Video without Downloading.
Please suggest me to resolve this issue
Thanks in Advance...
I could solve it just by appending the access_token to the download url
audiofile.strPath=[NSString stringWithFormat#"%#&access_token=%#",downloadUrl,accessToken];
pass the strPath to your avplayer object to play music.
I did not try the video part. but i think a similar approach should work.
you can fetch the access token from the GTMOAuth2Authentication object
Note that you might need to refresh it if its expires.
Hope this helps you.
Regards
Nitesh
I think it depends what you mean by "stream". Last time I looked, the download links all had a content disposition: attachment header, which instructs the browser to download rather than render the content.
If you have your own client fetching the url, you can choose to ignore that header and do what you like with the content as it is fetched. imho, it would be nice if the client could add a parameter to the url to indicate to the Google servers that it wants the content to be rendered v. downloaded, but hey ho.
You need to authorize all requests to downloadLinks with an Authorization header. Read more about the authorization and learn how to retrieve your users an access token on https://developers.google.com/drive/about-auth

Getting Client's Timezone in GWT

My application is hosted at one place whose Timezone is "A". And user can login from anywhere. Let's say he/she logged in from place whose timezone "B". I want the timezone of User from where he/she get logged in. So I can display him dates in his/her timezone.
So is there any way to get that user's timezone?
A way to retrieve the client's timezone is to use javascript code through a native JNI method, as following:
private native int getClientOffsetTimeZone() /*-{
return new Date().getTimezoneOffset();
}-*/;
Note that the getTimezoneOffset() method returns the time difference between UTC time and local time, in minutes.
For example, If your time zone is GMT+2, -120 will be returned.
GWT has the com.google.gwt.core.client.JsDate library, which is a wrapper to the JSNI that Yeser mentioned. That library exposes the native JavaScript Date object, which allows you to use getTimezoneOffset().
From client, you can retrieve the timezone offset with Date.getTimezoneOffset() and pass it to your server then use this offset to create correct Dates.

Facebook creating event start_time format issue

I am using FB API for creating events and I have problem with timeformat of start_time. When I use this format:
2013-05-04T09:00:00+0200
witch is relevant to my timezone I am getting back error code 100 about Invalid parameter.
I've tested that a little bit so I know that problem is in "+". When I use this api same way but for any time with "-" (2013-05-04T09:00:00-0200) it works and event is created - of course with wrong time displayed on FB page...
Any ideas? Thank you very much!

Facebook: Fetching status message for a particular date

I want to read my status message that was posted at a particular date, say 6 months back. Is it possible to fetch this message using the Facebook Graph APIs?
Thanks,
Saurabh
Yes, check for the since and until parameters.
http://developers.facebook.com/docs/reference/api/
until, since (a unix timestamp or any date accepted by strtotime): https://graph.facebook.com/search?until=yesterday&q=orange