(角度)js:从日期和时间选择器到纪元时间

时间:2015-06-05 13:09:21

标签: javascript angularjs datetime epoch

我正在写一个使用纪元时间(毫秒)的rest api的前端。我正在使用here中的日期和时间选择器。如何根据给定的值创建纪元时间?

如何从我学会here的纪元创建可读日期。但我无法找到其他方向的解决方案(给出时间格式并从字符串创建纪元时间)。

1 个答案:

答案 0 :(得分:0)

datepicker / scope变量应该是Date对象的一个​​实例,然后你可以在其上调用getTime

RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
Button button1 = (Button)findViewById(R.id.button_operations);
button1.setLayoutParams(params);

//or set its position relative to another button:
params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.RIGHT_OF, button1.getId());
Button button2 = (Button)findViewById(R.id.secondBtn);
button2.setLayoutParams(params);

//or set its margins like this (left, top, right, bottom):
params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
params.setMargins(200, 600, 0, 0); //if it is possible don't use hard coded numbers, use parameters based on screen resolution instead
Button button3 = (Button)findViewById(R.id.thirdBtn);
button3.setLayoutParams(params);
相关问题