php date()没有收到年,月,日:NSDate到php

时间:2015-09-03 15:46:43

标签: php ios date nsdate

我有一个php web服务,我正在从iOS应用程序向Web服务发送NSDate。这是我收到日期的PHP:

echo 'formatted T/S '.$u_timestamp = date('Y-m-d H:i:s', trim(strip_tags($_REQUEST['timestamp'])));

这是我使用我的网址发送的日期:

timestamp=2015-09-03%2013:52:09%20+0000

我收到的很好,但我的输出是这样的:

1970-01-01 00:33:35

有人知道我的php有什么问题我没有正确收到NSDate吗?

1 个答案:

答案 0 :(得分:1)

1970-01-01 00:00:00函数将 Unix 时间戳作为第二个参数(即date('Y-m-d H:i:s', strtotime(trim(strip_tags($_REQUEST['timestamp'])))); 以来的秒数)

试试这个:

import UIKit

class Utils: UIViewController {

    class func msgBox (titleStr:String = "Untitled", messageStr:String = "Alert text", buttonStr:String = "Ok") {
        var alert = UIAlertController(title: titleStr, message: messageStr, preferredStyle: UIAlertControllerStyle.Alert)
        alert.addAction(UIAlertAction(title: buttonStr, style: .Default, handler: { (action) -> Void in
            self.dismissViewControllerAnimated(true, completion: nil)
        }))
        self.presentViewController(alert, animated: true, completion: nil)
    }

}
相关问题