我正试图以24小时格式获取设备的时间 我从系统得到的是12h格式这里是我做的代码:
var time = this.msToTime(this.state.time);
var houresFormated = moment(time.getTime(), ["h:mm A"]).format("HH:mm");
// console.log(time);
time = time.getTime();
和进口:
import React, { Component } from 'react';
// import './Log.css';
import {
StyleSheet,
TextInput,
Modal,
TouchableHighlight,
Dimensions,
} from 'react-native';
import {
Button,
Text,
View,Form,Icon
} from "native-base";
import DatePicker from "react-native-datepicker";
const window = Dimensions.get('window');
import firebase from 'react-native-firebase';
import moment from 'moment';
有没有办法让我能以24小时的格式获得时间? 或者稍后在视图中将其更改为24小时?