gee system time 转换为 date

gee system time 转换为 date

// Random dummy Image
var image = ee.Image("COPERNICUS/S2_SR/20200401T001611_20200401T001605_T01WCR");

// system:time_start is saved as miliseconds (epoch):
var epoch = image.get("system:time_start")
print("Epoch system:time_start:",epoch)

// This can be converted to a readable date object by passing it to ee.Date
var readableDate = ee.Date(epoch)
print("Epoch Time as ee.Date Object:", readableDate)

// To get from an Date object to a string, use .format() and the format you want to use
var stringDate = readableDate.format("YYYY-MM-dd")
print("ee.Date object to string", stringDate)

// To get back to the epoch timestamp (miliseconds) use .millis() on an ee.Date object
// This is absolutely necessary if you want to put a new date into system:time_start
var toMillis = readableDate.millis()
print("Back from ee.Date to Epoch", toMillis)

其他方式,利用儒略日计算

function  composite(startDoy) {
  startDoy = ee.Number(startDoy);
  return ndviCol
    .filter(ee.Filter.calendarRange(startDoy, startDoy.add(15), 'day_of_year'))
    .reduce(ee.Reducer.median())
    .set('system:time_start', startDoy);
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值