Skip to content

data.ourtime #

Ourtime

import freeflowuniverse.crystallib.data.ourtime

now := ourtime.now()

println(now.key())

fn get_unix_from_absolute #

fn get_unix_from_absolute(timestr_ string) !i64

fn new #

fn new(txt_ string) !OurTime

Get Expiration object from time string input . input can be either relative or absolute . if input is empty then is now

## Relative time
#### time periods:
- s : second
- h : hour
- d : day
- w : week
- M : month
- Q : quarter
- Y : year
0 means right now
input string example: "+1w +2d -4h"

## Absolute time
inputs must be of the form: "YYYY-MM-DD HH:mm:ss" or "YYYY-MM-DD"
the time can be HH:mm:ss or HH:mm
inputs also supported are: "DD-MM-YYYY" but then the YYYY needs to be 4 chars
for date we also support / in stead of -
input string examples:

'2022-12-5 20:14:35'
'2022-12-5' - sets hours, mins, seconds to 00

fn new_from_epoch #

fn new_from_epoch(ut u64) OurTime

fn now #

fn now() OurTime

struct OurTime #

struct OurTime {
pub mut:
	unixt i64
}

fn (OurTime) check #

fn (mut ot OurTime) check()

will check if the time is empty, if yes then will fill it in

fn (OurTime) md #

fn (ot OurTime) md() string

print the wiki formatting for time

fn (OurTime) key #

fn (ot OurTime) key() string

format as a usable key . "YYYY_MM_DD_HH_mm_ss"

fn (OurTime) str #

fn (ot OurTime) str() string

returns a date-time string in "YYYY-MM-DD HH:mm" format (24h).

fn (OurTime) day #

fn (ot OurTime) day() string

returns a date string in "YYYY-MM-DD" format

fn (OurTime) int #

fn (ot OurTime) int() int

returns as epoch (seconds)

fn (OurTime) now #

fn (mut t OurTime) now()

set ourtime to now

fn (OurTime) time #

fn (t OurTime) time() time.Time

get time from vlang

fn (OurTime) unix #

fn (t OurTime) unix() i64

get time from vlang

fn (OurTime) empty #

fn (t OurTime) empty() bool

fn (OurTime) warp #

fn (mut t OurTime) warp(warp string) !

move the time, e.g. +1h means we go 1 h further## Relative time

time periods:

  • s : second
  • h : hour
  • d : day
  • w : week
  • M : month
  • Q : quarter
  • Y : yearinput string example: "+1w +2d -4h"