当前位置: 首页 > news >正文

网站功能模块报价软件开发主要是干什么的

网站功能模块报价,软件开发主要是干什么的,wordpress 数据表前缀,找建设网站公司吗设置系统时间 本模块用来设置、获取当前系统时间,设置、获取当前系统日期和设置、获取当前系统时区。 说明: 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 导入模块 import systemTime …

设置系统时间

本模块用来设置、获取当前系统时间,设置、获取当前系统日期和设置、获取当前系统时区。

icon-note.gif 说明: 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

导入模块

import systemTime from '@ohos.systemTime';

systemTime.setTime

setTime(time : number, callback : AsyncCallback) : void

设置系统时间。

需要权限: ohos.permission.SET_TIME

系统能力: SystemCapability.Miscservices.Time

参数:

参数名类型必填说明
timenumber目标时间戳(ms)。
callbackAsyncCallback回调函数,可以在回调函数中处理接口返回值。

示例:

// time对应的时间为2021-01-20 02:36:25
var time = 1611081385000;
systemTime.setTime(time, (error, data) => {if (error) {console.error(`failed to systemTime.setTime because ` + JSON.stringify(error));return;}console.log(`systemTime.setTime success data : ` + JSON.stringify(data));
});

systemTime.setTime

setTime(time : number) : Promise

设置系统时间。

需要权限: ohos.permission.SET_TIME

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
timenumber目标时间戳(ms)。

返回值:

类型说明
Promise返回的异步回调函数。

示例:

// time对应的时间为2021-01-20 02:36:25
var time = 1611081385000;
systemTime.setTime(time).then((data) => {console.log(`systemTime.setTime success data : ` + JSON.stringify(data));
}).catch((error) => {console.error(`failed to systemTime.setTime because ` + JSON.stringify(error));
});

systemTime.getCurrentTime8+

getCurrentTime(isNano?: boolean, callback: AsyncCallback): void

获取自 Unix 纪元以来经过的时间,使用callback形式返回结果。

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
isNanoboolean如果是true,返回纳秒数;否则返回毫秒数。
callbackAsyncCallback回调函数,返回自 Unix 纪元以来经过的时间。

示例:

systemTime.getCurrentTime(true, (error, data) => {if (error) {console.error(`failed to systemTime.getCurrentTime because ` + JSON.stringify(error));return;}console.log(`systemTime.getCurrentTime success data : ` + JSON.stringify(data));
});

systemTime.getCurrentTime8+

getCurrentTime(isNano?: boolean): Promise

获取自 Unix 纪元以来经过的时间,使用Promise形式返回结果。

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
isNanoboolean如果是true,返回纳秒数;否则返回毫秒数。

返回值:

类型说明
Promise以Promise形式返回结果,返回自 Unix 纪元以来经过的时间。

示例:

systemTime.getCurrentTime().then((data) => {console.log(`systemTime.getCurrentTime success data : ` + JSON.stringify(data));
}).catch((error) => {console.error(`failed to systemTime.getCurrentTime because ` + JSON.stringify(error));
});

systemTime.getRealActiveTime8+

getRealActiveTime(isNano?: boolean, callback: AsyncCallback): void

获取自系统启动以来经过的时间,不包括深度睡眠时间,使用callback形式返回结果。

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
isNanoboolean如果是true,返回纳秒数;否则返回毫秒数。
callbackAsyncCallback回调函数,返回自系统启动以来但不包括度睡眠时间经过的时间。

示例:

systemTime.getRealActiveTime(true, (error, data) => {if (error) {console.error(`failed to systemTime.getRealActiveTimebecause ` + JSON.stringify(error));return;}console.log(`systemTime.getRealActiveTime success data : ` + JSON.stringify(data));
});

systemTime.getRealActiveTime8+

getRealActiveTime(isNano?: boolean): Promise

获取自系统启动以来经过的时间,不包括深度睡眠时间,使用Promise形式返回结果。

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
isNanoboolean如果是true,返回纳秒数;否则返回毫秒数。

返回值:

类型说明
Promise以Promise形式返回结果,返回自系统启动以来经过的时间,但不包括深度睡眠时间。

示例:

systemTime.getRealActiveTime().then((data) => {console.log(`systemTime.getRealActiveTime success data : ` + JSON.stringify(data));
}).catch((error) => {console.error(`failed to systemTime.getRealActiveTime because ` + JSON.stringify(error));
});

systemTime.getRealTime8+

getRealTime(callback: AsyncCallback): void

获取自系统启动以来经过的时间,包括深度睡眠时间,使用callback形式返回结果。

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
isNanoboolean如果是true,返回纳秒数;否则返回毫秒数。
callbackAsyncCallback回调函数,返回自系统启动以来经过的时间,包括深度睡眠时间。

示例:

systemTime.getRealTime(true, (error, data) => {if (error) {console.error(`failed to systemTime.getRealTime because ` + JSON.stringify(error));return;}console.log(`systemTime.getRealTime success data: ` + JSON.stringify(data));
});

systemTime.getRealTime8+

getRealTime(): Promise

获取自系统启动以来经过的时间,包括深度睡眠时间,使用Promise形式返回结果。

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
isNanoboolean如果是true,返回纳秒数;否则返回毫秒数。

返回值:

类型说明
Promise以Promise形式返回结果,返回自系统启动以来经过的时间,包括深度睡眠时间。

示例:

systemTime.getRealTime().then((data) => {console.log(`systemTime.getRealTime success data: ` + JSON.stringify(data));
}).catch((error) => {console.error(`failed to systemTime.getRealTime because ` + JSON.stringify(error));
});

systemTime.setDate

setDate(date: Date, callback: AsyncCallback): void

设置系统日期,使用callback形式返回结果。

需要权限: ohos.permission.SET_TIME

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
dateDate目标日期。
callbackAsyncCallback回调函数,可以在回调函数中处理接口返回值。

示例:

var data = new Date("October 13, 2020 11:13:00");
systemTime.setDate(data,(error, data) => {       if (error) {            console.error('failed to systemTime.setDate because ' + JSON.stringify(error));           return;       
}        console.info('systemTime.setDate success data : ' + JSON.stringify(data));    
});

systemTime.setDate

setDate(date: Date): Promise

设置系统日期,使用Promise形式返回结果。

需要权限: ohos.permission.SET_TIME

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
dateDate目标日期。

返回值:

类型说明
Promise返回的异步回调函数。

示例:

var data = new Date("October 13, 2020 11:13:00"); 
systemTime.setDate(data).then((value) => {        console.log(`systemTime.setDate success data : ` + JSON.stringify(value));    
}).catch((error) => {        console.error(`failed to systemTime.setDate because: ` + JSON.stringify(error));
});

systemTime.getDate8+

getDate(callback: AsyncCallback): void

获取当前系统日期,使用callback形式返回结果。

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
callbackAsyncCallback回调函数,返回当前系统日期。

示例:

systemTime.getDate((error, data) => {if (error) {console.error(`failed to systemTime.getDate because ` + JSON.stringify(error));return;}console.log(`systemTime.getDate success data : ` + JSON.stringify(data));
});

systemTime.getDate8+

getDate(): Promise

获取当前系统日期,使用Promise形式返回结果。

系统能力: SystemCapability.MiscServices.Time

返回值:

类型说明
Promise以Promise形式返回结果,返回当前系统日期。

示例:

systemTime.getDate().then((data) => {console.log(`systemTime.getDate success data : ` + JSON.stringify(data));
}).catch((error) => {console.error(`failed to systemTime.getDate because ` + JSON.stringify(error));
});

systemTime.setTimezone

setTimezone(timezone: string, callback: AsyncCallback): void

设置系统时区。

需要权限: ohos.permission.SET_TIME_ZONE

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
timezonestring系统时区。
callbackAsyncCallback回调函数,可以在回调函数中处理接口返回值。

示例:

systemTime.setTimezone('Asia/Shanghai', (error, data) => {       if (error) {          console.error('failed to systemTime.setTimezone because ' + JSON.stringify(error));         return;       }       console.info('SystemTimePlugin systemTime.setTimezone success data : ' + JSON.stringify(data)); 
});

systemTime.setTimezone

setTimezone(timezone: string): Promise

设置系统时区。

需要权限: ohos.permission.SET_TIME_ZONE

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
timezonestring系统时区。

返回值:

类型说明
Promise返回的异步回调函数。

示例:

systemTime.setTimezone('Asia/Shanghai').then((data) => {        console.log(`systemTime.setTimezone success data : ` + JSON.stringify(data));     
}).catch((error) => {        console.error(`failed to systemTime.setTimezone because: ` + JSON.stringify(error));    
});

systemTime.getTimezone8+

getTimezone(callback: AsyncCallback): void

获取系统时区,使用callback形式返回结果。

系统能力: SystemCapability.MiscServices.Time

参数:

参数名类型必填说明
callbackAsyncCallback回调函数,返回系统时区。

示例:

systemTime.getTimezone((error, data) => {if (error) {console.error(`failed to systemTime.getTimezone because ` + JSON.stringify(error));return;}console.log(`systemTime.getTimezone success data : ` + JSON.stringify(data));
});

systemTime.getTimezone8+

getTimezone(): Promise

获取系统时区,使用Promise形式返回结果。

系统能力: SystemCapability.MiscServices.Time

返回值:

类型说明
Promise以Promise形式返回结果,返回系统时区。

在这里插入图片描述

示例:

systemTime.getTimezone().then((data) => {console.log(`systemTime.getTimezone success data : ` + JSON.stringify(data));
}).catch((error) => {console.error(`failed to systemTime.getTimezone because ` + JSON.stringify(error));
});
http://www.yayakq.cn/news/110976/

相关文章:

  • 网站怎么做文件下载wordpress评论不了
  • 网站变成灰色微信小程序卖东西
  • 楼盘网站建设网站开发手册
  • 做可动模型的网站网站推广包括
  • 网站建设如何空间绑定域名简单的公司网站
  • 创建网站目录权限wordpress 提示插件
  • 微信自助建站系统小程序价格为什么比网站建设高
  • 做药物研发的人上什么网站晋城企业网站建设价格
  • 云南 网站建设织梦大气婚纱影楼网站源码 dedecms摄影工作室网站模板
  • app开发一般需要多少钱南京网站seo
  • 建设银行咸阳交费网站建立收费网站
  • 自动化培训网站建设域名历史查询工具
  • 如何做网站呢北京 响应式网站建设
  • 做机械的网站有哪些正规专业的网站建设公
  • 网站开发时如何兼容网站广告弹出来代码
  • 手机版文章网站源码家乡网站策划书建设背景
  • 吉林省建设厅网站首页垂直网站建设的关键因素
  • 福州高端网站建设公司北京微信网站搭建费用
  • 好网站开发公司广西壮族自治区建设厅官方网站
  • 网站建设考试卷a卷网站建设与维护设计报告
  • 网站建设与维护实训报告电脑字体怎么导入到wordpress
  • 网站建设投标ppt用Python做网站如何配置域名
  • 网站没建好可以备案吗设计师的招聘要求
  • 商城网站备案流程如何自己做引流推广
  • 网站文章模块网站建设的定位是什么意思
  • 网站通栏是什么短视频制作自学教程
  • 餐馆网站模板专门做恐怖电影的网站
  • 贵阳专业网站建设公司哪家好连接外国的网站吗
  • 网站开发上证k线郑州网站制作网页
  • 长沙有什么做试卷的网站wordpress重定向自定义