【问题标题】:Date on titanium钛金属日期
【发布时间】:2013-12-13 11:09:27
【问题描述】:

这个问题有点奇怪,不好意思。

我在http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Pickerhttp://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Picker阅读了钛文档

我也看了题目Date and Time in picker view in android for titanium

我想知道钛是否了解日期? 我必须将它用于两件事:用于日期选择器(在 android 上工作)和操作日期。

但是,当我尝试使用钛时,钛会发出非常糟糕的警报

date = new Date();
...
something(date.now());//alert here.
someotherthingorso(date.getTime());//alert here two if i delete the first.

那么,我们可以用钛上的 Date 做什么?只有构造函数和吸气剂对我有用。 是否有替代 date.now() 或 date.getTime() 有效?也适用于 datePicker。

【问题讨论】:

  • 从未使用过钛,但链接的文档似乎表明在 Android 上使用具有整数值的微调器进行选择,从而允许您从各个组件中弥补日期。它不是一个日期对象,但它似乎是根据文档的方式。
  • 试试System.currentTimeInMilis()
  • 系统在钛上是未知的:)。但很好。 @@merlin @@François Whal 。明白了,我可以在没有实现 Date 对象或 dateTime 的情况下使用它。(看起来很奇怪)。

标签: javascript android date titanium


【解决方案1】:

Titanium 完全支持 Date 对象,因为它是一个内置的 JavaScript 对象。您只是错误地使用了Date 对象。

now() 方法仅适用于实际的 Date 对象,您可以这样称呼它:

Date.now()

虽然 getTime() 方法仅适用于 Date 实例:

var d = new Date();
d.getTime();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-11-06
    • 1970-01-01
    • 2012-08-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多