MomentJS西班牙语时间 [英] MomentJS time in spanish

查看:115
本文介绍了MomentJS西班牙语时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用下一个代码转换从MySQL数据库格式 1993-10-23 00:00:00 收到的日期,并以西班牙文显示:

I am using the next code to convert a date received from a MySQL database format 1993-10-23 00:00:00 and display it in spanish:

alert(moment('1993-10-23 00:00:00', 'YYYY-MM-DD', 'es')); 

23月10日是星期六。我希望得到sábado但我得到了下一个:

23 oct is saturday. I would expect to get sábado but I get the next:

Sat Oct 23 1993 00:00:00 GMT+0200

还尝试添加: moment.locale('es-ES'); moment.locale('en-ES'); moment.locale('es');
但不起作用。

Also tried adding: moment.locale('es-ES'); , moment.locale('en-ES'); and moment.locale('es'); but neither works.

将日期从一种语言转换为另一种语言的正确方法是什么?

What's the correct way of converting dates from a language to another?

推荐答案

这似乎有效,谢谢@RobG

This seems to work, thanks @RobG

var localLocale = moment('1993-10-23 00:00:00');
moment.locale('es');
localLocale.locale(false);
alert(localLocale.format('LLLL')); 

这篇关于MomentJS西班牙语时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆