neo4j使用详解(六、cypher即时时间函数语法——最全参考)

news2024/11/25 2:30:31

请添加图片描述


Neo4j系列导航:
neo4j及简单实践
cypher语法基础
cypher插入语法
cypher插入语法
cypher查询语法
cypher通用语法
cypher函数语法


6.时间函数-即时类型

表示具体的时刻的时间类型函数

6.1.date函数

年-月-日时间函数: yyyy-mm-dd

6.1.1.获取date

  • date(): 获取当前时间,如果未指定时区参数,则将使用本地时区 date([{timezone}])

    return date() as currentDate // 返回值2024-04-01
    return date({timezone: 'America/Los Angeles'}) // 返回值2024-04-01

  • date.transaction(): 使用transaction时返回当前date。对于同一事务中的每次调用,该值都是相同的 date.transaction([{timezone}])

    return date.transaction() as currentDate // 返回值2024-04-01

  • date.statement(): 使用statement返回当前date值。对于同一语句中的每次调用,该值都相同。但是,同一事务中的不同语句可能会产生不同的值 date.statement([{timezone}])

    return date.statement() as currentDate // 返回值2024-04-01

  • date.realtime(): 使用date返回当前值realtime。该值将是系统的实时时钟。 (系统时间)date.realtime([{timezone}])

    return date.realtime() as currentDate // 返回值2024-04-01

6.1.2.创建date

  • 创建 年-月-日: 返回一个date值,其中包含指定的年、月、日 date({year [, month, day]})

    unwind [date({year: 1984, month: 10, day: 11}),date({year: 1984, month: 10}),date({year: 1984})] as theDate return theDate // 返回值1984-10-11, 1984-10-01, 1984-01-01

  • 创建 年-周-日: date({year [, week, dayOfWeek]})

    unwind [date({year: 1984, week: 10, dayOfWeek: 3}), date({year: 1984, week: 10}),date({year: 1984})] as theDate return theDate // 返回值1984-03-07, 1984-03-05, 1984-01-01

  • 创建 年-季度-日: date({year [, quarter, dayOfQuarter]})

    unwind [date({year: 1984, quarter: 3, dayOfQuarter:45}),date({year: 1984, quarter: 3}),date({year: 1984})] as theDate return theDate // 返回值1984-08-14, 1984-07-01, 1984-01-01

  • 创建 年-日: date({year [, ordinalDay]})

    unwind [date({year: 1984, ordinalDay: 202}),date({year: 1984})] AS theDate return theDate // 返回值1984-07-20, 1984-01-01

  • 创建 根据时间字符串: date(temporalValue)

    unwind [date('2015-07-21'),date('2015-07'),date('201507'),date('2015-W30-2'),date('2015202'),date('2015')] as theDate return theDate // 返回值2015-07-21, 2015-07-01, 2015-07-01, 2015-07-21, 2015-07-21, 2015-01-01

  • 创建 使用其他时间组件: date({date [, year, month, day, week, dayOfWeek, quarter, dayOfQuarter, ordinalDay]})

    unwind [ date({year: 1984, month: 11, day: 11}), localdatetime({year: 1984, month: 11, day: 11, hour: 12, minute: 31, second: 14}), datetime({year: 1984, month: 11, day: 11, hour: 12, timezone: '+01:00'}) ] as dd return date({date: dd}) as dateOnly, date({date: dd, day: 28}) as dateDay

6.1.3.分割date

返回date通过在指定组件边界(由作为参数传递给函数的截断单元表示)处最近的先前时间点处截断指定瞬时瞬时值而获得的值。
date.truncate(unit [, temporalInstantValue [, mapOfComponents ] ])

参数含义
unit计算结果为以下string值之一的字符串表达式:'millennium', 'century', 'decade', 'year', 'weekYear', 'quarter', 'month', 'week', 'day'
temporalInstantValue以下类型之一的表达式:ZONED DATETIME, LOCAL DATETIME, DATE
mapOfComponents计算包含小于 的分量的映射的表达式unit

实例:

with datetime({
    year: 2017, month: 11, day: 11,
    hour: 12, minute: 31, second: 14, nanosecond: 645876123,
    timezone: '+01:00'
  }) as d
  return
  date.truncate('millennium', d) as truncMillenium,
  date.truncate('century', d) as truncCentury,
  date.truncate('decade', d) AS truncDecade,
  date.truncate('year', d, {day: 5}) AS truncYear,
  date.truncate('weekYear', d) as truncWeekYear,
  date.truncate('quarter', d) as truncQuarter,
  date.truncate('month', d) as truncMonth,
  date.truncate('week', d, {dayOfWeek: 2}) as truncWeek,
  date.truncate('day', d) as truncDay

结果:

千禧年节截断世纪截断十年截断年份截断周年截断季度截断月份截断周截断日
2000-01-012000-01-012010-01-012017-01-052017-01-022017-10-012017-11-012017-11-072017-11-11

6.2.datetime函数

年-月-日 时:分:秒:毫秒时间函数:yyyy-mm-ddThh:MM:SS:sssZ

6.2.1.获取datetime

  • datetime(): datetime([{timezone}])

    return datetime() //2024-04-01T10:02:28.192Z
    return datetime({timezone: 'America/Los Angeles'}) // 2024-04-01T03:02:28.238-07:00[America/Los_Angeles]

  • datetime.transaction(): datetime.transaction([{timezone}])

    return datetime.transaction() //2024-04-01T18:02:28.290Z
    RETURN datetime.transaction('America/Los Angeles') //2024-04-01T03:02:28.338-07:00[America/Los_Angeles]

  • datetime.statement(): datetime.statement([{timezone}])

    return datetime.statement() //2024-04-01T10:02:28.395Z

  • datetime.realtime(): datetime.realtime([{timezone}])

    return datetime.realtime() //2024-04-01T10:02:28.494444Z

6.2.2.创建datatime时间

datetime()返回一个带时区的datetime值,其中包含指定的年、月、日、时、分、秒、毫秒、微秒、纳秒和时区组件值。

  • 创建 年-月-日 时:分:秒: datetime({year [, month, day, hour, minute, second, millisecond, microsecond, nanosecond, timezone]})
    实例:

    unwind[
    	datetime({year: 1984, month: 10, day: 11, hour: 12, minute: 31, second: 14, millisecond: 123, microsecond: 456, nanosecond: 789}),
    	datetime({year: 1984, month: 10, day: 11, hour: 12, minute: 31, second: 14, millisecond: 645, timezone: '+01:00'}),
    	datetime({year: 1984, month: 10, day: 11, hour: 12, minute: 31, second: 14, nanosecond: 645876123, timezone: 'Europe/Stockholm'}),
    	datetime({year: 1984, month: 10, day: 11, hour: 12, minute: 31, second: 14, timezone: '+01:00'}),
    	datetime({year: 1984, month: 10, day: 11, hour: 12, minute: 31, second: 14}),
    	datetime({year: 1984, month: 10, day: 11, hour: 12, minute: 31, timezone: 'Europe/Stockholm'}),
    	datetime({year: 1984, month: 10, day: 11, hour: 12, timezone: '+01:00'}),
    	datetime({year: 1984, month: 10, day: 11, timezone: 'Europe/Stockholm'})
    ] as theDate return theDate
    

    结果:

    返回值
    1984-10-11T12:31:14.123456789Z
    1984-10-11T12:31:14.645+01:00
    1984-10-11T12:31:14.645876123+01:00[Europe/Stockholm]
    1984-10-11T12:31:14+01:00
    1984-10-11T12:31:14Z
    1984-10-11T12:31+01:00[Europe/Stockholm]
    1984-10-11T12:00+01:00
    1984-10-11T00:00+01:00[Europe/Stockholm]
  • 创建 年-周-日: datetime({year [, week, dayOfWeek, hour, minute, second, millisecond, microsecond, nanosecond, timezone]})
    实例:

    unwind[
    	datetime({year: 1984, week: 10, dayOfWeek: 3, hour: 12, minute: 31, second: 14, millisecond: 645}),
    	datetime({year: 1984, week: 10, dayOfWeek: 3, hour: 12, minute: 31, second: 14, microsecond: 645876, timezone: '+01:00'}),
    	datetime({year: 1984, week: 10, dayOfWeek: 3, hour: 12, minute: 31, second: 14, nanosecond: 645876123, timezone: 'Europe/Stockholm'}),
    	datetime({year: 1984, week: 10, dayOfWeek: 3, hour: 12, minute: 31, second: 14, timezone: 'Europe/Stockholm'}),
    	datetime({year: 1984, week: 10, dayOfWeek: 3, hour: 12, minute: 31, second: 14}),
    	datetime({year: 1984, week: 10, dayOfWeek: 3, hour: 12, timezone: '+01:00'}),
    	datetime({year: 1984, week: 10, dayOfWeek: 3, timezone: 'Europe/Stockholm'})
    ] as theDate return theDate
    

    结果:

    返回值
    1984-03-07T12:31:14.645Z
    1984-03-07T12:31:14.645876+01:00
    1984-03-07T12:31:14.645876123+01:00[Europe/Stockholm]
    1984-03-07T12:31:14+01:00[Europe/Stockholm]
    1984-03-07T12:31:14Z
    1984-03-07T12:00+01:00
    1984-03-07T00:00+01:00[Europe/Stockholm]
  • 创建 年-季度-日: datetime({year [, quarter, dayOfQuarter, hour, minute, second, millisecond, microsecond, nanosecond, timezone]})
    实例:

    unwind[
    	datetime({year: 1984, quarter: 3, dayOfQuarter: 45, hour: 12, minute: 31, second: 14, microsecond: 645876}),
    	datetime({year: 1984, quarter: 3, dayOfQuarter: 45, hour: 12, minute: 31, second: 14, timezone: '+01:00'}),
    	datetime({year: 1984, quarter: 3, dayOfQuarter: 45, hour: 12, timezone: 'Europe/Stockholm'}),
    	datetime({year: 1984, quarter: 3, dayOfQuarter: 45})
    ] as theDate return theDate
    

    结果:

    返回值
    1984-08-14T12:31:14.645876Z
    1984-08-14T12:31:14+01:00
    1984-08-14T12:00+02:00[Europe/Stockholm]
    1984-08-14T00:00Z
  • 创建 年-日: datetime({year [, ordinalDay, hour, minute, second, millisecond, microsecond, nanosecond, timezone]})
    实例:

    unwind[
    	datetime({year: 1984, ordinalDay: 202, hour: 12, minute: 31, second: 14, millisecond: 645}),
    	datetime({year: 1984, ordinalDay: 202, hour: 12, minute: 31, second: 14, timezone: '+01:00'}),
    	datetime({year: 1984, ordinalDay: 202, timezone: 'Europe/Stockholm'}),
    	datetime({year: 1984, ordinalDay: 202})
    ] as theDate return theDate
    

    结果:

    返回值
    1984-07-20T12:31:14.645Z
    1984-07-20T12:31:14+01:00
    1984-07-20T00:00+02:00[Europe/Stockholm]
    1984-07-20T00:00Z
  • 创建 根据时间字符串: datetime(temporalValue)
    实例:

    unwind[
    	datetime('2015-07-21T21:40:32.142+0100'),
    	datetime('2015-W30-2T214032.142Z'),
    	datetime('2015T214032-0100'),
    	datetime('20150721T21:40-01:30'),
    	datetime('2015-W30T2140-02'),
    	datetime('2015202T21+18:00'),
    	datetime('2015-07-21T21:40:32.142[Europe/London]'),
    	datetime('2015-07-21T21:40:32.142-04[America/New_York]')
    ] as theDate return theDate
    

    结果:

    返回值
    2015-07-21T21:40:32.142+01:00
    2015-07-21T21:40:32.142Z
    2015-01-01T21:40:32-01:00
    2015-07-21T21:40-01:30
    2015-07-20T21:40-02:00
    2015-07-21T21:00+18:00
    2015-07-21T21:40:32.142+01:00[Europe/London]
    2015-07-21T21:40:32.142-04:00[America/New_York]
  • 创建 使用其他时间组件:
    datetime({datetime [, year, ..., timezone]}) | datetime({date [, year, ..., timezone]}) | datetime({time [, year, ..., timezone]}) | datetime({date, time [, year, ..., timezone]})
    实例:

    with date({year: 1984, month: 10, day: 11}) as dd
    return
    datetime({date: dd, hour: 10, minute: 10, second: 10}) as dateHHMMSS,
    datetime({date: dd, hour: 10, minute: 10, second: 10, timezone:'+05:00'}) as dateHHMMSSTimezone,
    datetime({date: dd, day: 28, hour: 10, minute: 10, second: 10}) as dateDDHHMMSS,
    datetime({date: dd, day: 28, hour: 10, minute: 10, second: 10, timezone:'Pacific/Honolulu'}) as dateDDHHMMSSTimezone
    

    结果:

    dateHHMMSSdateHHMMSSTimezonedateDDHHMMSSdateDDHHMMSSTimezone
    1984-10-11T10:10:10Z1984-10-11T10:10:10+05:001984-10-28T10:10:10Z1984-10-28T10:10:10-10:00[Pacific/Honolulu]
  • 创建 根据时间戳: datetime({ epochSeconds | epochMillis })

    return datetime({epochSeconds: timestamp() / 1000, nanosecond: 23}) //2022-06-14T10:02:30.000000023Z
    return datetime({epochMillis: 424797300000}) //1983-06-18T15:15Z

6.2.3.分割datetime

返回datetime通过在指定组件边界(由作为参数传递给函数的截断单元表示)处最近的先前时间点处截断指定瞬时值而获得的值。
datetime.truncate(unit [, temporalInstantValue [, mapOfComponents ] ])

参数含义
unit求值为以下字符串之一的字符串表达式:‘millennium’、‘century’、‘decade’、‘year’、‘weekYear’、‘quarter’、‘month’、‘week’、‘day’、‘hour’、‘minute’、‘second’、‘millisecond’、‘microsecond’。
temporalInstantValue以下类型之一的表达式:ZONED DATETIME, LOCAL DATETIME, DATE
mapOfComponents求值为包含小于单位的组件的映射的表达式。在截断期间,可以使用键时区附加或覆盖时区。

实例:

with
  datetime({
    year:2017, month:11, day:11,
    hour:12, minute:31, second:14, nanosecond: 645876123,
    timezone: '+03:00'
  }) AS d
return
  datetime.truncate('millennium', d, {timezone: 'Europe/Stockholm'}) as truncMillenium,
  datetime.truncate('year', d, {day: 5}) as truncYear,
  datetime.truncate('month', d) as truncMonth,
  datetime.truncate('day', d, {millisecond: 2}) as truncDay,
  datetime.truncate('hour', d) as truncHour,
  datetime.truncate('second', d) as truncSecond

结果:

truncMilleniumtruncYeartruncMonthtruncDaytruncHourtruncSecond
2000-01-01T00:00+01:00[Europe/Stockholm]2017-01-05T00:00+03:002017-11-01T00:00+03:002017-11-11T00:00:00.002+03:002017-11-11T12:00+03:002017-11-11T12:31:14+03:00

6.3.localdatetime函数

年-月-日 时:分:秒:毫秒时间函数:yyyy-mm-ddThh:MM:SS:sss

6.3.1.获取localdatetime

  • localdatetime(): localdatetime([{timezone}])

    return localdatetime() //2024-04-01T10:02:30.447
    return localdatetime({timezone: 'America/Los Angeles'}) // 2024-04-01T03:02:30.482

  • localdatetime.transaction(): localdatetime.transaction([{timezone}])

    return localdatetime.transaction() //2024-04-01T10:02:30.532

  • localdatetime.statement(): localdatetime.statement([{timezone}])

    return localdatetime.statement() //2024-04-01T10:02:30.570

  • localdatetime.realtime(): localdatetime.realtime([{timezone}])

    return localdatetime.realtime() //2024-04-01T10:02:30.647817
    return localdatetime.realtime('America/Los Angeles') //2024-04-01T03:02:30.691099

6.3.2.创建localdatetime

  • 创建 年-月-日:
    localdatetime({year [, month, day, hour, minute, second, millisecond, microsecond, nanosecond]})

    return 
      localdatetime({
        year: 1984, month: 10, day: 11,
        hour: 12, minute: 31, second: 14, millisecond: 123, microsecond: 456, nanosecond: 789
      }) as theDate
    
    返回值
    1984-10-11T12:31:14.123456789
  • 创建 年-周-日:
    localdatetime({year [, week, dayOfWeek, hour, minute, second, millisecond, microsecond, nanosecond]})

    return
    localdatetime({
    	year: 1984, week: 10, dayOfWeek: 3,
    	hour: 12, minute: 31, second: 14, millisecond: 645
    }) as theDate
    
    返回值
    1984-03-07T12:31:14.645
  • 创建 年-季-日:
    localdatetime({year [, quarter, dayOfQuarter, hour, minute, second, millisecond, microsecond, nanosecond]})

    return
    localdatetime({
    year: 1984, quarter: 3, dayOfQuarter: 45,
    hour: 12, minute: 31, second: 14, nanosecond: 645876123
    }) as theDate
    
    返回值
    1984-08-14T12:31:14.645876123
  • 创建 年-日:
    localdatetime({year [, ordinalDay, hour, minute, second, millisecond, microsecond, nanosecond]})

    return
    localdatetime({
    year: 1984, ordinalDay: 202,
    hour: 12, minute: 31, second: 14, microsecond: 645876
    }) as theDate
    
    返回值
    1984-07-20T12:31:14.645876
  • 创建 时间格式字符串: localdatetime(temporalValue)

    unwind [
    	localdatetime('2015-07-21T21:40:32.142'),
    	localdatetime('2015-W30-2T214032.142'),
    	localdatetime('2015-202T21:40:32'),
    	localdatetime('2015202T21')
    	] as theDate
    return theDate
    
    返回值
    2015-07-21T21:40:32.142
    2015-07-21T21:40:32.142
    2015-07-21T21:40:32
    2015-07-21T21:00
  • 创建 使用其他时间组件:
    localdatetime({datetime [, year, ..., nanosecond]}) | localdatetime({date [, year, ..., nanosecond]}) | localdatetime({time [, year, ..., nanosecond]}) | localdatetime({date, time [, year, ..., nanosecond]})
    实例1:

    with date({year: 1984, month: 10, day: 11}) as dd
    return
    	localdatetime({date: dd, hour: 10, minute: 10, second: 10}) as dateHHMMSS,
    	localdatetime({date: dd, day: 28, hour: 10, minute: 10, second: 10}) as dateDDHHMMSS
    
    dateHHMMSSdateDDHHMMSS
    1984-10-11T10:10:101984-10-28T10:10:10

    实例2:

    WITH
      datetime({
        year: 1984, month: 10, day: 11,
        hour: 12,
        timezone: '+01:00'
      }) as dd
    return
      localdatetime({datetime: dd}) as dateTime,
      localdatetime({datetime: dd, day: 28, second: 42}) as dateTimeDDSS
    
    dateTimedateTimeDDSS
    1984-10-11T12:001984-10-28T12:00:42

6.3.3.分割localdatetime

localdatetime.truncate(unit [, temporalInstantValue [, mapOfComponents ] ])
实例:

with
  localdatetime({
    year: 2017, month: 11, day: 11,
    hour: 12, minute: 31, second: 14, nanosecond: 645876123
  }) as d
return
  localdatetime.truncate('millennium', d) as truncMillenium,
  localdatetime.truncate('year', d, {day: 2}) as truncYear,
  localdatetime.truncate('month', d) as truncMonth,
  localdatetime.truncate('day', d) as truncDay,
  localdatetime.truncate('hour', d, {nanosecond: 2}) as truncHour,
  localdatetime.truncate('second', d) as truncSecond
truncMilleniumtruncYeartruncMonthtruncDaytruncHourtruncSecond
2000-01-01T00:002017-01-02T00:002017-11-01T00:002017-11-11T00:002017-11-11T12:00:00.0000000022017-11-11T12:31:14

6.4.localtime函数

时:分:秒:毫秒时间函数:hh:MM:SS.sss

6.4.1.获取localtime

  • localtime(): localtime([{timezone}])

    return localtime() //10:02:30.447
    return localtime({timezone: 'America/Los Angeles'}) // 03:02:30.482

  • localtime.transaction(): localtime.transaction([{timezone}])

    return localtime.transaction() //10:02:30.532

  • localtime.statement(): localtime.statement([{timezone}])

    return localtime.statement() //10:02:30.570

  • localtime.realtime(): localtime.realtime([{timezone}])

    return localtime.realtime() //10:02:30.647817
    return localtime.realtime('America/Los Angeles') //03:02:30.691099

6.4.2.创建localtime

  • 创建localtime:
    localtime({hour [, minute, second, millisecond, microsecond, nanosecond]})

    unwind[
    	localtime({hour: 12, minute: 31, second: 14, nanosecond: 789, millisecond: 123, microsecond: 456}),
    	localtime({hour: 12, minute: 31, second: 14}),
    	localtime({hour: 12})
    ] as theTime
    return theTime
    
    返回值
    12:31:14.123456789
    12:31:14
    12:00
  • 创建 根据Time格式字符串: localtime(temporalValue)

    unwind[
    	localtime('21:40:32.142'),
    	localtime('214032.142'),
    	localtime('21:40'),
    	localtime('21')
    ] as theTime
    return theTime
    
    返回值
    21:40:32.142
    21:40:32.142
    21:40
    21:00
  • 创建 使用其他时间组件: localtime({time [, hour, ..., nanosecond]})
    实例:

    with time({hour: 12, minute: 31, second: 14, microsecond: 645876, timezone: '+01:00'}) as tt
    return
      localtime({time: tt}) as timeOnly,
      localtime({time: tt, second: 42}) as timeSS
    
    timeOnlytimeSS
    12:31:14.64587612:31:42.645876

6.4.3.分割localime

localtime.truncate(unit [, temporalInstantValue [, mapOfComponents ] ])
实例:

with time({hour: 12, minute: 31, second: 14, nanosecond: 645876123, timezone: '-01:00'}) as t
return
  localtime.truncate('day', t) as truncDay,
  localtime.truncate('hour', t) as truncHour,
  localtime.truncate('minute', t, {millisecond: 2}) as truncMinute,
  localtime.truncate('second', t) as truncSecond,
  localtime.truncate('millisecond', t) as truncMillisecond,
  localtime.truncate('microsecond', t) as truncMicrosecond
truncDaytruncHourtruncMinutetruncSecondtruncMillisecondtruncMicrosecond
00:00:0012:00:0012:31:00.00200000012:31:1412:31:14.64500000012:31:14.645876000

6.5.time函数

时:分:秒:毫秒时间函数:hh:MM:SS.sssZ

6.4.1.获取time

  • time(): time([{timezone}])

    return time() //10:02:30.447
    return time({timezone: 'America/Los Angeles'}) // 03:02:32.351-07:00

  • time.transaction(): localtime.transaction([{timezone}])

    return time.transaction() //10:02:30.532Z

  • time.statement(): localtime.statement([{timezone}])

    return time.statement() //10:02:30.570Z

  • time.realtime(): localtime.realtime([{timezone}])

    return time.realtime() //10:02:30.647817Z
    return time.realtime('America/Los Angeles') //03:02:32.351-07:00

6.4.2.创建time

  • 创建localtime:
    time({hour [, minute, second, millisecond, microsecond, nanosecond, timezone]})

    unwind[
    	time({hour: 12, minute: 31, second: 14, millisecond: 123, microsecond: 456, nanosecond: 789}),
    	time({hour: 12, minute: 31, second: 14, nanosecond: 645876123}),
    	time({hour: 12, minute: 31, second: 14, microsecond: 645876, timezone: '+01:00'}),
    	time({hour: 12, minute: 31, timezone: '+01:00'}),
    	time({hour: 12, timezone: '+01:00'})
    ] as theTime
    return theTime
    
    返回值
    12:31:14.123456789Z
    12:31:14.645876123Z
    12:31:14.645876000+01:00
    12:31:00+01:00
    12:00:00+01:00
  • 创建 根据Time格式字符串: time(temporalValue)

    unwind[
    	time('21:40:32.142+0100'),
    	time('214032.142Z'),
    	time('21:40:32+01:00'),
    	time('214032-0100'),
    	time('21:40-01:30'),
    	time('2140-00:00'),
    	time('2140-02'),
    	time('22+18:00')
    	] as theTime
    return theTime
    
    返回值
    21:40:32.142000000+01:00
    21:40:32.142000000Z
    21:40:32+01:00
    21:40:32-01:00
    21:40:00-01:30
    21:40:00Z
    21:40:00-02:00
    22:00:00+18:00
  • 创建 使用其他时间组件: time({time [, hour, ..., timezone]})
    实例:

    with localtime({hour: 12, minute: 31, second: 14, microsecond: 645876}) AS tt
    return
      time({time: tt}) as timeOnly,
      time({time: tt, timezone: '+05:00'}) as timeTimezone,
      time({time: tt, second: 42}) as timeSS,
      time({time: tt, second: 42, timezone: '+05:00'}) as timeSSTimezone
    
    timeOnlytimeTimezonetimeSStimeSSTimezone
    12:31:14.645876Z12:31:14.645876+05:0012:31:42.645876Z12:31:42.645876+05:00

6.4.3.分割localime

time.truncate(unit [, temporalInstantValue [, mapOfComponents ] ])
实例:

with time({hour: 12, minute: 31, second: 14, nanosecond: 645876123, timezone: '-01:00'}) as t
return 
  time.truncate('day', t) as truncDay,
  time.truncate('hour', t) as truncHour,
  time.truncate('minute', t) as truncMinute,
  time.truncate('second', t) as truncSecond,
  time.truncate('millisecond', t, {nanosecond: 2}) as truncMillisecond,
  time.truncate('microsecond', t) as truncMicrosecond
truncDaytruncHourtruncMinutetruncSecondtruncMillisecondtruncMicrosecond
00:00:00-01:0012:00:00-01:0012:31:00-01:0012:31:14-01:0012:31:14.645000002-01:0012:31:14.645876000-01:00

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1561709.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

深度学习500问——Chapter05: 卷积神经网络(CNN)(3)

文章目录 5.14 理解转置卷积与棋盘效应 5.14.1 标准卷积 5.14.2 转置卷积 5.15 卷积神经网络的参数设置 5.16 提高卷积神经网络的泛化能力 5.17 卷积神经网络在不同领域的应用 5.17 .1 联系 5.17.2 区别 5.14 理解转置卷积与棋盘效应 5.14.1 标准卷积 在理解转置卷积之前&…

从学习海底捞到学习巴奴,中国餐饮带洋快餐重归“产品主义”

俗话说“民以食为天”,吃饭一向是国人的头等大事,餐饮业也是经济的强劲助推力。新世纪以来,餐饮业不断讲述着热辣滚烫的商业故事。 2006年,拥有“必胜客”、“肯德基”等品牌的餐饮巨头百胜集团,组织两百多名区域经理…

代码随想录算法训练营第24天|理论基础 |77. 组合

理论基础 jia其实在讲解二叉树的时候,就给大家介绍过回溯,这次正式开启回溯算法,大家可以先看视频,对回溯算法有一个整体的了解。 题目链接/文章讲解:代码随想录 视频讲解:带你学透回溯算法(理…

Windows安装禅道系统结合Cpolar实现公网访问内网BUG管理服务

文章目录 前言1. 本地安装配置BUG管理系统2. 内网穿透2.1 安装cpolar内网穿透2.2 创建隧道映射本地服务3. 测试公网远程访问4. 配置固定二级子域名4.1 保留一个二级子域名5.1 配置二级子域名6. 使用固定二级子域名远程 前言 BUG管理软件,作为软件测试工程师的必备工具之一。在…

竞技之道-打造成功竞技游戏的实战指南【文末送书】

文章目录 理解竞技游戏的本质游戏力:竞技游戏设计实战教程【文末送书】 在当今数字化时代,游戏已经不再是一种单纯的娱乐方式,而是成为了一门具有巨大商业潜力的产业。特别是竞技游戏,它们引领着全球数十亿玩家的潮流,…

引用,内联函数,auto函数,指针nullptr

一:引用 1.1 该文章的引用是对上一篇引用的进行补充和完善 按理来说,double可以隐式转换为int,那起别名的时候为什么不可以类型转换呢? 那是因为,在类型转换的时候,会创建一个临时变量,让后再…

基于kalman的单目标追踪,以及demo测试(Python and C++)

一.卡尔曼滤波简单介绍 我们可以在任何含有不确定信息的动态系统中的使用卡尔曼滤波,对系统的下一步动作做出有根据的猜测。猜测的依据是预测值和观测值,首先我们认为预测值和观测值都符合高斯分布且包含误差,然后我们预设预测值的误差Q和观测…

OMNet项目1 —— Linux环境配置

项目环境搭建,软件版本Ubuntu16,OMNet5.0 Linux配置环境步骤 安装VMWare虚拟机16.25(个人号养老版本)下载ISO镜像文件Ubuntu16 链接:https://pan.baidu.com/s/1SETyn6t4qIUfli1uRRgm3w?pwdf4ua 提取码:f…

软件设计师25--逻辑结构设计

软件设计师25--逻辑结构设计 考点1:关系模式相关概念数据模型关系模型相关概念完整性约束 考点2:E-R图转换关系模式逻辑结构设计 - E-R模型转关系模式E - R图转关系模式 考点1:关系模式相关概念 数据模型 层次模型网状模型关系模型面向对象…

第四百三十六回

文章目录 1. 概念介绍2. 思路与方法2.1 实现思路2.2 实现方法 3. 示例代码4. 内容总结 我们在上一章回中介绍了"不同平台上换行的问题"相关的内容,本章回中将介绍如何在页面上显示蒙板层.闲话休提,让我们一起Talk Flutter吧。 1. 概念介绍 我…

ElMessageBox.confirm中内容换行

ElMessageBox.confirm(导入结果&#xff1a;<br/>成功导入${res.successCount}条数据&#xff0c;导入失败${res.errorList.length}条数据。<br/>${str},"提示",{confirmButtonText: "确定",cancelButtonText: "取消",type: "w…

云原生应用(5)之Dockerfile精讲及新型容器镜像构建技术

一、容器与容器镜像之间的关系 说到Docker管理的容器不得不说容器镜像&#xff0c;主要因为容器镜像是容器模板&#xff0c;通过容器镜像我们才能快速创建容器。 如下图所示&#xff1a; Docker Daemon通过容器镜像创建容器。 二、容器镜像分类 操作系统类 CentOS Ubuntu 在…

38.HarmonyOS鸿蒙系统 App(ArkUI)堆叠布局结合弹性布局

层叠布局用于在屏幕上预留一块区域来显示组件中的元素&#xff0c;提供元素可以重叠的布局。层叠布局通过Stack容器组件实现位置的固定定位与层叠&#xff0c;容器中的子元素&#xff08;子组件&#xff09;依次入栈&#xff0c;后一个子元素覆盖前一个子元素&#xff0c;子元素…

Spring源码分析(BeanDefinition)

文章目录 Spring源码分析&#xff08;BeanDefinition&#xff09;一、概述1、BeanDefinition 的理解2、BeanDefinition 接口3、BeanDefinition 的实现4、BeanDefinitionHolder 类 二、BeanDefinition 的加载1、reader 的获取1&#xff09;registerAnnotationConfigProcessors2&…

浅谈高阶智能驾驶-NOA领航辅助的技术与发展

浅谈高阶智能驾驶-NOA领航辅助的技术与发展 附赠自动驾驶学习资料和量产经验&#xff1a;链接 2019年在国内首次试驾特斯拉NOA领航辅助驾驶的时候&#xff0c;当时兴奋的觉得未来已来;2020年在试驾蔚来NOP领航辅助驾驶的时候&#xff0c;顿时不敢小看国内新势力了;现在如果哪家…

第十八章 算法

一、介绍 1.1 什么是算法 算法&#xff08;Algorithm&#xff09;是指解题方案的准确而完整的描述&#xff0c;是一系列解决问题的清晰指令&#xff0c;算法代表着用系统的方法描述解决问题的策略机制。也就是说&#xff0c;能够对一定规范的输入&#xff0c;在有限时间内获…

kubernetes之实战进阶篇

目录 一、搭建kubenetes集群 1.1、搭建方案选择 1.2、软硬件准备 1.2.1、硬件要求: 1.2.2、软件要求 1.3、安装步骤 1.3.1、初始化操作(三个节点都要执行一遍) 1.3.2、部署kubernetes master节点(控制面板) 1.3.3、node节点加入k8s集群 1.3.4、部署CNI网络插件 1.3.…

【经典算法】LeetCode14:最长公共前缀(Java/C/Python3实现含注释说明,Easy)

最长公共前缀 题目思路及实现方式一&#xff1a;横向扫描思路代码实现Java版本C语言版本Python3版本 复杂度分析 方式二&#xff1a;纵向扫描思路代码实现Java版本C语言版本Python3版本 复杂度分析 方式三&#xff1a;分治思路代码实现Java版本C语言版本Python3版本 复杂度分析…

VBA技术资料MF136:复制整个数据范围到PowerPoint

我给VBA的定义&#xff1a;VBA是个人小型自动化处理的有效工具。利用好了&#xff0c;可以大大提高自己的工作效率&#xff0c;而且可以提高数据的准确度。“VBA语言専攻”提供的教程一共九套&#xff0c;分为初级、中级、高级三大部分&#xff0c;教程是对VBA的系统讲解&#…

Php_Code_challenge13

题目&#xff1a; 答案&#xff1a; 解析&#xff1a; 开启一个会话&#xff0c;在SESSION变量"nums"为空时则对"nums","time","whoami"进行赋值&#xff0c;并在120秒后关闭会话&#xff0c;创建一个变量"$value"…