我正在使用Parse数据库。我存储日期格式。使用控制台时,我会得到以下格式:Tue Jul 18 2017 15:46:47 GMT+0100 (CET)
我希望得到这种格式:18-07-2017。
请知道
答案 0 :(得分:2)
我已经能够像本机一样得到你想要的反应结果:
从'时刻导入时刻&#39 ;; //导入momentjs - > https://momentjs.com
const maxDate = moment(新日期,' DD-MM-YYYY')。format(); // 15-11-2017T11:17:30 + 01:00
我希望这对你有用。
答案 1 :(得分:2)
可以通过使用以下代码来完成:
import React, { PureComponent } from "react";
import "../../assets/css/bootstrap.min.css";
import "../../assets/css/demo.css";
import "../../assets/css/light-bootstrap-dashboard.css";
import "./font-awesome-min.css";
import "./fonts.css";
import "./dashbord.css";
import Sidebar from "./Sidebar";
import Header from "./Header";
import Footer from "./Footer";
class Dashbord extends PureComponent {
render() {
return (
<div className="wrapper">
<div className="sidebar-background">
<Sidebar />
</div>
<div className="main-panel">
<Header />
<div class="content" />
<Footer />
</div>
</div>
);
}
}
export default Dashbord;
答案 2 :(得分:0)
片刻库对于您想要在日期执行的所有操作/格式设置非常棒。
你应该这样做:
public class QuoteBillItem{
private String netrate;
public String getNetrate() {
return netrate;
}
public void setNetrate(String netrate) {
this.netrate = netrate;
}
}
@Repository
public class RedisRepository {
@Autowired
private RedisTemplate<String, Object> redisTemplate;
private HashOperations<String, String, Object> itemHash;
public void saveItem(String hashKey, Object quoteBillItem) {
itemHash.put("category", hashKey, qb);
}
public void updateItem(QuoteBillItem qb, String newNr){
qb.setNetrate(newNr);
}
public QuoteBillItem getFromMap(String hashKey){
return (QuoteBillItem)itemHash.get("category", hashKey);
}
}
QuoteBillItem qb = new QuoteBillItem();
qb.setNetrate("1");
RedisRepository.saveItem("qb:key1",qb);
RedisRepository.updateItem(qb, "2");
QuoteBillItem qbcached = RedisRepository.getFromMap("qb:key1");
String nr = qbcached.getNetrate();