Solved

Convert date

Posted on 2011-09-09
7
403 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
7 Comments
 
LVL 25

Expert Comment

by:epasquier
Comment Utility
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
Comment Utility
And here we go !

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

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

Expert Comment

by:mlmcc
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 45

Expert Comment

by:aikimark
Comment Utility
@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
Comment Utility
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
Comment Utility
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 100

Assisted Solution

by:mlmcc
mlmcc earned 250 total points
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This article will show, step by step, how to integrate R code into a R Sweave document
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now