javascript - 如何将波斯数字转换为英文
问题描述
我想获取日期(shamsi 日期),然后将数字转换为英文进行计算。我需要将“现在”转换为英文数字。
function HTMLUI(){}
//display year
HTMLUI.prototype.displayYear = function(){
//get max year
const now = new Date().toLocaleDateString('fa-IR')
console.log(now.slice(0, 4));
}
解决方案
你的意思是这样吗?
HTMLUI.prototype.displayYear = function(){
const theYear = new Date().getUTCFullYear().toString();
console.log( theYear );
}
推荐阅读
- php - 当表格在每个页面上时将 $_GET 存储到 $_SESSION 联系表格 7
- php - Laravel:用户登录时用户生日重置
- jsf - primeFaces 不重新渲染组件
- android - 我们可以通过编程设置呼叫转移吗?
- java - Java中的lambda目标类型和目标类型上下文是什么意思?
- spring-boot - 如何让spring data mongodb在每个测试方法之前执行createIndexes?
- python - pyspark 使用 saveAsNewAPIHadoopFile 将 dstream 数据写入 es 得到警告
- java - Java 类型转换:转换实际上在哪里?
- php - RDS 数据库 AWS amazon 中的 MySQL 连接错误 - 安全组问题
- php - php字符串到对象变量 - 替换对象的名称