Solved

Convert date

Posted on 2011-09-09
7
408 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
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 100

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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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 100

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
word0 challenge 4 68
Firemonkey android show image from resource ? 1 42
Graphics32 under Delphi 10.1 Berlin 2 62
Work with App store 7 51
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

776 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