Solved

Convert date

Posted on 2011-09-09
7
412 Views
Last Modified: 2012-05-12
Hi Experts,

I am using api of facebook to get some informations about my events, but the date of event is comming this way:

<start_time>1357093800</start_time>
<end_time>1357104600</end_time>

How convert this in a datetime with Delphi Xe
Thanks for some help
0
Comment
Question by:alpires
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 25

Expert Comment

by:epasquier
ID: 36510804
you can use this website
http://www.onlineconversion.com/unix_time.htm

ok, I know it is a joke, you mean in code :o) Well that is my first finding on your subject, the format of the data you have is "UNIX TimeStamp" . All we have to do now is finding its coding and why not a Delphi function that converts it
0
 
LVL 25

Expert Comment

by:epasquier
ID: 36510815
And here we go !

http://www.delphifaq.com/faq/f91.shtml

it's easier when you know what the format is
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 36510822
That appears to be a Unix datetime which is kept as the number of seconds since a specific date.  I forget the date.

Here is a question that I believe solves it
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_20006708.html

mlmcc
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 45

Expert Comment

by:aikimark
ID: 36510923
@alpires

according to the epasquier, the date values are:
1/2/2013 2:30:00 AM
1/2/2013 5:30:00 AM
0
 

Author Comment

by:alpires
ID: 36511271
The problem is that dates dont mach

In face book 1357093800 is January 1, 2013 14:30:00 and not Wed, 02 Jan 2013 02:30:00

Some idea ?
0
 
LVL 25

Accepted Solution

by:
epasquier earned 250 total points
ID: 36511724
yes, you have problems with Time Zones. You must know which TZ is used by facebook (I hope UTC, but some source talks about pacific time), then convert that (shift is a better word)  to your own. That is another problem.

here are a few starters :
http://stackoverflow.com/questions/4134718/facebook-events-and-timezones-how-to-convert-utc-datetime-to-what-facebook-expec
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 250 total points
ID: 36511725
Unix Time is generally saved as GMT so to use it you have to adjust for the time zone.  

For you, you subtract 4 hours from the time.

For me in Central US I subtract 6 hours (5 during Dylight savings)

That is 12 hours earlier so it is probably for someone in the south Pacific like on Somoa.

mlmcc
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question