formatTime与“h”而不是“:”作为分隔符 [英] formatTime with "h" instead of ":" as separator

查看:92
本文介绍了formatTime与“h”而不是“:”作为分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在葡萄牙使用以下24小时制: 18h30
我试过了:

We use the following 24 hour format for time in Portugal: 18h30. I've tried:

timeFormat: 'H'h'(mm)'
timeFormat: {'H'h'(mm)'}
timeFormat: 'H\h(mm)'

有可能吗?
谢谢。

Is it possible? Thank you.

推荐答案

您需要在JavaScript字符串中使用单引号插入字母 h 作为文字文本。最简单的方法是使用双引号作为字符串分隔符,如下所示:

You need to use single quotes inside the javascript string to insert the letter h as literal text. The easiest way for this is to use double quotes as string delimiters, as in:

timeFormat: "H'h'(mm)"

作为参考,如果您想在单引号字符串中使用单引号,请使用转义对于每个报价,如下所示:

For reference, if you want to use single quotes inside a single quoted string, use an escape for each quote, as in:

timeFormat: 'H\'h\'(mm)'

这篇关于formatTime与“h”而不是“:”作为分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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