Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Group: Handling of time
Topic: Generating timepoints
See also: settimegran settimezero getnow getlocalnow

Function: settime
Description: settime generates from a set of vectors a vector of time points. The parameter yr (year) is necessary, the parameters mo (month), dy (day of month), hr (hour), mn (minute), sc (second) are optional. The granulation of the measurement can be changed which the command setgran. Each value in v describes the distance to a fixed point in time (usually 1.1.1900 0:00:00.0). The zero time can be changed with the command setzero. Be careful that you not try to span too much time with a too small granulation !!

Usage: t = settime (yr {, mo {, dy {, hr {, mn {, sc}}}}}})
Input:
yr n x 1 vector
mo n x 1 vector
dy n x 1 vector
hr n x 1 vector
mn n x 1 vector
sc n x 1 vector
Output:
t n x 1 time vector

Example:

; sets year to 1901, ..., 2038
yr = #(1901, 1902, 2037, 2038)
; Date  9th Oct, Time: 5 min 32 sec after midnight 
mo = 10*matrix(rows(yr))
dy =  9*matrix(rows(yr))
hr =  0*matrix(rows(yr))
mi =  5*matrix(rows(yr))
sc = 32*matrix(rows(yr))
t  = settime (yr, mo, dy, hr, mi, sc)
; check dates
st = dayofmonth(t) +"."+month(t)+"."+year(t)+" "+hour(t)+":"+minute(t)+":"+second(t)	
; note: you can just span time points from 1902 till 2037
st 
Result:

Contents of st

[1,] "14.Nov.2037 06:33:48"
[2,] "09.Oct.1902 00:05:32"
[3,] "09.Oct.2037 00:05:32"
[4,] "02.Sep.1902 17:37:16"

Group: Handling of time
Topic: Generating timepoints
See also: settimegran settimezero getnow getlocalnow

Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

(C) MD*TECH Method and Data Technologies, 28.6.1999