Michael Geschwill
Michael Geschwill

Reputation: 1

NSDate and PHP echo out

i use the Predicate Editor to make Filter and save results to mysql. Dates will be saved (Today) as: 316077618.500794

My Question: How can i calculate this in a PHP Time? I want to echo out this date as a Realdate but i find no way how to calc this for php.

I cant modify in cocoa code, it must be format out in PHP.

I need help :)

Thank you very much.

Upvotes: 0

Views: 591

Answers (2)

Nicolas
Nicolas

Reputation: 1116

NSDate Reference Tells me :

The sole primitive method of NSDate, timeIntervalSinceReferenceDate, provides the basis for all the other methods in the NSDate interface. This method returns a time value relative to an absolute reference date—the first instant of 1 January 2001, GMT.

You have 2 options:

  1. Modify your cocoa code to export the date in a familiar format. (Yes, this may not be an option, but it will honestly be the easiest)
  2. Do the calculation yourself. There is danger in this, in that you've got to be sure that you don't mess up the timezone. In it's simplest, it's 978307200 + NSDate.

Upvotes: 2

user578271
user578271

Reputation: 1

oh thank you :) The Soulution is:

$NSDATE='-61737774.586439';
$d=mktime(0, 0, 0, 1, 1, 2001)+ ($NSDATE) ;
echo date("d.m.Y",$d);

:D

Hope helps :)

Upvotes: 0

Related Questions