example using date time to access the hours and mins
Function datefunction2a
unfortunately DateTime GetParts returns hours in 24h format so kinda un does some of the formatting done before it but easy to convert back to 12h format
Function datefunction2a
out
//// just for demo purposes
str csv=
;25/4/2018,18:23
;25/4/2018,12:23
;25/4/2018,04:23
/////
out csv
out "------------------------------------------------------------"
;create ICsv variable and load data
ICsv x._create
x.FromString(csv);; comment out or remove this line and use line 15 below to load from a csv file
// aslo remove lines 4-10
//x.FromFile("path of csv file") load csv data from file
str cell1 cell2
int nr=x.RowCount
int nc=x.ColumnCount
int r c
for r 0 nr ;;for each row
,for c 0 nc ;;for each column
,,if(c=0)
,,,cell1=x.Cell(r c)
,,,DATE d(cell1)
,,,cell1.timeformat("{MM/dd/yyyy}" d)
,,,x.Cell(r c)=cell1
,,else
,,,cell2=x.Cell(r c)
,,,DATE d1(cell2)
,,,cell2.timeformat("{hh:mm tt}" d1)
,,,x.Cell(r c)=cell2
,,,DateTime dd
,,,dd.FromStr(cell2)
,,,int hours mins
,,,dd.GetParts(0 0 0 hours mins 0)
,,,if(hours-12 >= 0)
,,,,if(hours =12)
,,,,,out "%i pm" hours
,,,,else
,,,,,hours-12
,,,,,out "%i pm" hours
,,,else
,,,,out "%i am" hours
,,,out mins
,,,out "////////////////////////////////////////////////////"
x.ToString(csv);
out csv ;;show CSV