doudu8291 2017-08-13 01:29
浏览 46

在自定义属性类型日期中插入带有cmis的“日期”

I have a custom type Clinical Record where some field is cli:date_created. The type of this property is Date.

When I try to set this field (with php) I get Argument of type "string" given but argument of type "\DateTime" was expected.". But I am giving a Date and not a string.

'cli:date_created' => date('d/m/Y',strtotime($resultado[0]['fecha_alta'])),

What do I have to do in order to insert a date? Because I don't want to change the type from date to string in this field.

  • 写回答

1条回答 默认 最新

  • duanjiong5686 2017-08-13 01:45
    关注

    Yes, you do give a string argument as the date function returns string.

    Return Values ¶

    Returns a formatted date string. If a non-numeric value is used for timestamp, FALSE is returned and an E_WARNING level error is emitted.

    You need to pass a DateTime instance, e.g. using new \DateTime() constructor or another function that return a DateTime instance such as DateTime::createFromFormat

    'cli:date_created' => DateTime::createFromFormat('[yourformat]', $resultado[0]['fecha_alta']),
    
    评论

报告相同问题?

悬赏问题

  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow