将JQGrid的毫秒数转换为日期格式 [英] converting the milliseconds to date format for JQGrid
问题描述
我的Jqgrid的数据源是一个返回json的php 返回的json中的日期约束以毫秒为单位 我想将其转换为常规日期格式 我尝试寻找一种解决方案,最接近解决方案的是给定的解决方案[以下 JQ网格日期格式
My Jqgrid's data source is a php which returns a json The date constraint in the returned json is in milliseconds I want to convert it to regular date format I tried searching for a solution the one that got real close to solution is the one given [below JQ Grid Date Format
formatter:日期",formatoptions:{srcformat:"U",newformat:"d/m/Y"} 但是仍然无法解决我的问题,因为日期的格式不正确 24/10/146 根本不是正确的日期 期待一些有价值的修正或建议
formatter:'date', formatoptions: {srcformat: 'U', newformat:'d/m/Y'} But still it doesn't fix my issue as the date is not formulated right 24/10/146 which is not the correct date at all Looking forward to some worthy fixes or suggestions
1394085600000 (即返回的json数据)本质上应为 2014年6月3日
1394085600000 which is the returned json data should essentially be 03/06/2014
预先感谢
推荐答案
我自己想出了解决方案
感谢您的输入@oleg
但是问题是输入是毫秒,格式化程序src格式是"U",它是unix,毫秒/1000将在Unix中提供单位.
因此,到目前为止, {srcformat:'U/1000',newformat:'Y/d/m'} 为我提供了正确的日期格式,但
虽然这有点没有道理
但仍需公开问题以寻求合法答案
I figured out the solution myself
Thanks for the inputs @oleg
But the issue was the input being milliseconds and the formatter src format was "U" which is unix and milliseconds/1000 will provide the unit in Unix
So as for now {srcformat: 'U/1000', newformat:'Y/d/m'} gives me the right date format but
It doesn't kinda make sense though
But still keeping the question open for legitimate answer
谢谢
这篇关于将JQGrid的毫秒数转换为日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!