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

  • Home
  • SEARCH
  • 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 625109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:16:26+00:00 2026-05-13T19:16:26+00:00

How can I convert a COleDateTime::GetCurrentTime() to a unix time stamp or more specifically

  • 0

How can I convert a COleDateTime::GetCurrentTime() to a unix time stamp or more specifically I want to convert the value so I can use it in PHP with the date() function?

  • 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-13T19:16:26+00:00Added an answer on May 13, 2026 at 7:16 pm

    That sounds like the DATE type:

    The DATE type is implemented using an 8-byte floating-point number. Days are represented by whole number increments starting with 30 December 1899, midnight as time zero. Hour values are expressed as the absolute value of the fractional part of the number.

    test code:

    COleDateTime cdt(2010, 2, 15, 0, 0, 0); // 2010-02-15 12:00 AM
    DATE d = cdt; // using COleDateTime::operator DATE  
    printf("%f", d);
    

    prints 40224.000000.

    I don’t think there is a built-in function to convert this back to any “native” php date/time value (could be wrong though).

    edit: A (probably naive) starting point for a conversion function…
    some sample data create by

    LPCTSTR data[] = {
      _T("1976-03-27 05:54:00"),
      _T("1984-04-01 11:55:55"),
      _T("1996-01-25 08:30:00"),
      _T("2000-01-01 08:30:00"),
      _T("2010-02-14 00:00:00"),
      _T("2010-02-14 23:59:59"),
      _T("2010-02-15 00:00:00"),
      _T("2010-02-15 00:00:01"),
      _T("2010-02-23 15:30:00"),
      NULL
    };
    COleDateTime cdt;
    for(int i=0; data[i]; i++) {
      if ( !cdt.ParseDateTime(data[i]) ) {
        _tprintf(_T("%s: error\n"), data[i]);
      }
      else {
        _tprintf(_T("'%s'=>'%f'\n"), data[i], (DATE)cdt);
      }
    }
    

    lead to

    function DATE2unix($d) {
      static $jd2DATE_offset = 2415019;
      $date = intval($d); 
      $time = fmod($d, 1); 
      $ts = jdtounix($date+$jd2DATE_offset) + round($time*86400);
      return $ts;
    }
    
    $data = array(
      '1976-03-27 05:54:00'=>'27846.245833',
      '1984-04-01 11:55:55'=>'30773.497164',
      '1996-01-25 08:30:00'=>'35089.354167',
      '2000-01-01 08:30:00'=>'36526.354167',
      '2010-02-14 00:00:00'=>'40223.000000',
      '2010-02-14 23:59:59'=>'40223.999988',
      '2010-02-15 00:00:00'=>'40224.000000',
      '2010-02-15 00:00:01'=>'40224.000012',
      '2010-02-23 15:30:00'=>'40232.645833'
    );
    foreach($data as $target=>$d ) {
      $ts = DATE2unix($d);
      $date = gmdate('Y-m-d H:i:s', $ts);
      echo 'd=', $d, ' | target=', $target, ' | date=', $date, ' : ', ($target===$date) ? 'ok':'error', "\n";
    }
    

    which prints

    d=27846.245833 | target=1976-03-27 05:54:00 | date=1976-03-27 05:54:00 : ok
    d=30773.497164 | target=1984-04-01 11:55:55 | date=1984-04-01 11:55:55 : ok
    d=35089.354167 | target=1996-01-25 08:30:00 | date=1996-01-25 08:30:00 : ok
    d=36526.354167 | target=2000-01-01 08:30:00 | date=2000-01-01 08:30:00 : ok
    d=40223.000000 | target=2010-02-14 00:00:00 | date=2010-02-14 00:00:00 : ok
    d=40223.999988 | target=2010-02-14 23:59:59 | date=2010-02-14 23:59:59 : ok
    d=40224.000000 | target=2010-02-15 00:00:00 | date=2010-02-15 00:00:00 : ok
    d=40224.000012 | target=2010-02-15 00:00:01 | date=2010-02-15 00:00:01 : ok
    d=40232.645833 | target=2010-02-23 15:30:00 | date=2010-02-23 15:30:00 : ok
    

    Though these 9 samples seem to work ok I’m not sure about intval()/round() and whether there are other conventions the php code must follow. If you’re going to use this function, test it And then test it again with a lot more samples.
    And keep in mind that this is limited to the unix timestamp range which is smaller than the range of COleDateTime.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On Linux you can convert a date like 2010-10-02 to a unix timestamp in
How can I convert unix time to Hindu calendar ­Wikipedia time and the other
I can convert a unix timestamp to a Date() object by putting the long
we can convert character to an integer equivalent to the ASCII value of the
How i can convert number 20020415 to date 15.04.2002. I am working in Microsoft
we can convert the dictionary to kw using **kw but if I want kw
The SQL Server convert () function can convert varbinary data to a string with
Can someone tell me how I can convert a UTC date in JodaTime to
Is there a function in PostgreSQL that can convert a base 10 number like
I'm looking for a function that can convert 1 day to 86400000 or 20

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.