Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7002867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:59:05+00:00 2026-05-27T20:59:05+00:00

I have a server-equipment configuration where I need to change the equip date config,

  • 0

I have a server-equipment configuration where I need to change the equip date config, using UDP. The server is written in Java and the equipment, in Delphi.

So, the flow of the data is this:

Java server (Java date) -> UDP (integer date) -> Delphi equipment (Delphi date)

The problem is that when I pass the date as an integer, java calculates miliseconds from 1970, and Delphi, seconds. I pass then the date as following: today.getTime() / 1000, but the equipment understands this as a 2008 date, when we’re on 2012.

I can change the Java code, but the equipment is 3rd party and I don’t have access to it’s source code.

There’s difference between Java and Delphi date parsing that allow this discrepancy?

EDIT:
Thanks to MДΓΓ БДLL I noticed I was multiplying by 1000 instead of dividing by it, I now have a better date, but still wrong (was somewhen in 2033, now it’s in 2008).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:59:05+00:00Added an answer on May 27, 2026 at 8:59 pm

    A Unix time stamp is the same as the one used in Java. Delphi’s TDateTime, on the other hand, is based on a starting date of 12:01 AM on 12/30/1899 (it’s a COM compatibility thing), so some conversion is necessary. These functions will do it; I’ve also added a quick piece of test code to show the conversion works correctly both ways.

    const
      UnixStartDate = 25569.0;
    
    function DateTimeToUnixTime(const ADateTime: TDateTime): Cardinal;
    begin
      Result := Round(ADateTime - UnixStartDate) * 86400;
    end;
    
    function UnixTimeToDateTime(const UnixDate: Cardinal): TDateTime;
    begin
      Result := UnixDate / 86400 + UnixStartDate;
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var  StartDate: TDateTime;
      UnixDate: Cardinal;
    begin
      StartDate := Date();
      Memo1.Lines.Add('Start Date: ' + DateToStr(StartDate));
      UnixDate := DateTimeToUnixTime(StartDate);
      Memo1.Lines.Add('DateTimeToUnixTime = ' + IntToStr(UnixDate));
      Memo1.Lines.Add('UnixTimeToDateTime = ' + DateToStr(UnixTimeToDateTime(UnixDate)));
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using SQL Server 2008 R2. I have a table, EQUIPMENT , with
I have server in c and client in java but it doesn't work. 1.
I am using jQuery and have server code returning the following values 0:SELECT ONE;1:VALUE1;2:VALUE2
So in a nutshell, I have server set up using tcplistener / tcpclient, and
I have server and client code that works perfectly as a Java application. The
I have a client-server Silverlight application, which is use Socets. I have server appliaction
I'm working within a platform that I do not have server side access to
My server have default php version of 4, so when I run some script
I have a server in my network for which I want to DROP outbound
I have a server with 2 connections SOCKET which is connected with clients and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.