0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-30 19:41:46 +01:00
posthog/hogvm/__tests__/dateFormat.hog
Ben White cbf1f0c86f
feat(cdp): Added kinesis template (#23635)
Co-authored-by: Marius Andra <marius.andra@gmail.com>
2024-07-16 15:55:05 +02:00

49 lines
2.0 KiB
Plaintext

let dt := fromUnixTimestamp(1234377543.123456)
print(formatDateTime(dt, '%Y-%m-%d %H:%i:%S'))
print(formatDateTime(dt, '%Y-%m-%d %H:%i:%S', 'Europe/Brussels'))
print(formatDateTime(dt, '%Y-%m-%d %H:%i:%S', 'America/New_York'))
print(formatDateTime(dt, '%Y%m%dT%H%i%sZ'))
print('-----')
print('%a: ' || formatDateTime(dt, '%a'))
print('%b: ' || formatDateTime(dt, '%b'))
print('%c: ' || formatDateTime(dt, '%c'))
print('%C: ' || formatDateTime(dt, '%C'))
print('%d: ' || formatDateTime(dt, '%d'))
print('%D: ' || formatDateTime(dt, '%D'))
print('%e: ' || formatDateTime(dt, '%e'))
// print('%f: ' || formatDateTime(dt, '%f')) // 3 digits in Python, 6 digits in TypeScript
print('%F: ' || formatDateTime(dt, '%F'))
print('%g: ' || formatDateTime(dt, '%g'))
print('%G: ' || formatDateTime(dt, '%G'))
print('%h: ' || formatDateTime(dt, '%h'))
print('%H: ' || formatDateTime(dt, '%H'))
print('%i: ' || formatDateTime(dt, '%i'))
print('%I: ' || formatDateTime(dt, '%I'))
print('%j: ' || formatDateTime(dt, '%j'))
print('%k: ' || formatDateTime(dt, '%k'))
print('%l: ' || formatDateTime(dt, '%l'))
print('%m: ' || formatDateTime(dt, '%m'))
print('%M: ' || formatDateTime(dt, '%M'))
print('%n: ' || formatDateTime(dt, '%n'))
print('%p: ' || formatDateTime(dt, '%p'))
// print('%Q: ' || formatDateTime(dt, '%Q')) // not supported in Python
print('%r: ' || formatDateTime(dt, '%r'))
print('%R: ' || formatDateTime(dt, '%R'))
print('%s: ' || formatDateTime(dt, '%s'))
print('%S: ' || formatDateTime(dt, '%S'))
print('%t: ' || formatDateTime(dt, '%t'))
print('%T: ' || formatDateTime(dt, '%T'))
print('%u: ' || formatDateTime(dt, '%u'))
print('%V: ' || formatDateTime(dt, '%V'))
print('%w: ' || formatDateTime(dt, '%w'))
print('%W: ' || formatDateTime(dt, '%W'))
print('%y: ' || formatDateTime(dt, '%y'))
print('%Y: ' || formatDateTime(dt, '%Y'))
print('%z: ' || formatDateTime(dt, '%z'))
print('%%: ' || formatDateTime(dt, '%%'))
print('-----')
print(formatDateTime(dt, 'one banana'))
print(formatDateTime(dt, '%Y no way %m is this %d a %H real %i time %S'))