开发者

NSDate and PHP echo out

开发者 https://www.devze.com 2023-02-04 20:35 出处:网络
i use the Predicate Editor to make Filter and save results to mysql. Dates will be saved (Today) as: 316077618.500794

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 ech开发者_StackOverflowo 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.


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.


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 :)

0

精彩评论

暂无评论...
验证码 换一张
取 消