我在使用JSON解析从服务器返回的时间戳字符串时遇到了一些问题。我使用以下代码从HashMap中提取时间戳并将其显示在日志中:
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
Long time = Long.parseLong(event.get("time"));
final Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(time);
String event_date = sdf.format(cal.getTime
我希望创建此表,但希望以13位时间戳格式保存datetime,例如1424109603234
create table data (
datetime timestamp,
id text,
type text,
body text
primary key (id, type, datetime)
)
datetime的数据类型是否正确?我应该如何在像toTimestamp(now())这样的特定函数中插入数据?
在postgresql中,我的日期字段是数值,日期中的值类似于1401710352000,当我尝试使用to_timestamp( date )转换它时,我得到了相应的时间戳"46388-06-07 10:40:00+00“
我尝试在谷歌上搜索它,我发现了一些关于如何在postgresql中进行不同类型转换的非常有用的函数,但我找不到如何将数字日期转换为适当的可读格式。如果有人能告诉我如何将数字日期字段转换为时间戳/日期可读格式,我将不胜感激
Shah