lakoon
3rd June 2005, 10:15
Hello
I just wrote this small define to make the time conversion a little bit easier:
added some more macro's
|You can use it in the sprintf$ function to format the date
|Usage: string = sprintf$(YYYYMMDD, date.num())
|Usage: string = sprintf$(YYMMDD, date.num())
#define YYYYMMDD "%D(%04Y%02m%02d)"
#define YYMMDD "%D(%02y%02m%02d)"
|This returns a string in the various formats
|Usage: string = YYYY.MM.DD(date.num())
|Usage: string = YYYYMMDD(date.num())
|Usage: string = DD.MM.YY(date.num())
#define YYYY.MM.DD(act.date)
^ sprintf$("%D(%04Y.%02m.%02d)", act.date)
#define YYYYMMDD(act.date)
^ sprintf$("%D(%04Y%02m%02d)", act.date)
#define DD.MM.YY(act.date)
^ sprintf$("%D(%02d.%02m.%02y)", act.date)
|This returns the week and year for a given date
|Usage: string = WW.YYYY(date.num())
#define WW.YYYY(act.date)
^ sprintf$("%D(%02w.%04Y)", act.date)
|This returns the given time in a string with desired sign between hours, minuts and seconds
|Usage: string = HHMMSS(time.num(), "<your sign>")
#define HHMMSS$(act.time, deli)
^ sprintf$("%02d%s%02d%s%02d", act.time/3600, deli,
^ (act.time\3600)/60, deli, (act.time\3600)\60)
|This returns the given time as a long
|Usage: long = HHMMSS(time.num()) |Actual time.num()= 36030 results in 100030
#define HHMMSS(t)
^ ((t/3600)*10000) + (((t\3600)/60)*100) + ((t\3600)\60)
|This returns the seconds for given hour, minute and second (expl. User input)
|Usage: long = SECONDS(10, 00, 00) |10 am = 36000 Seconds
#define SECONDS(h, m, s)
^ ((h*3600) + (m*60) + s)
/lakoon
I just wrote this small define to make the time conversion a little bit easier:
added some more macro's
|You can use it in the sprintf$ function to format the date
|Usage: string = sprintf$(YYYYMMDD, date.num())
|Usage: string = sprintf$(YYMMDD, date.num())
#define YYYYMMDD "%D(%04Y%02m%02d)"
#define YYMMDD "%D(%02y%02m%02d)"
|This returns a string in the various formats
|Usage: string = YYYY.MM.DD(date.num())
|Usage: string = YYYYMMDD(date.num())
|Usage: string = DD.MM.YY(date.num())
#define YYYY.MM.DD(act.date)
^ sprintf$("%D(%04Y.%02m.%02d)", act.date)
#define YYYYMMDD(act.date)
^ sprintf$("%D(%04Y%02m%02d)", act.date)
#define DD.MM.YY(act.date)
^ sprintf$("%D(%02d.%02m.%02y)", act.date)
|This returns the week and year for a given date
|Usage: string = WW.YYYY(date.num())
#define WW.YYYY(act.date)
^ sprintf$("%D(%02w.%04Y)", act.date)
|This returns the given time in a string with desired sign between hours, minuts and seconds
|Usage: string = HHMMSS(time.num(), "<your sign>")
#define HHMMSS$(act.time, deli)
^ sprintf$("%02d%s%02d%s%02d", act.time/3600, deli,
^ (act.time\3600)/60, deli, (act.time\3600)\60)
|This returns the given time as a long
|Usage: long = HHMMSS(time.num()) |Actual time.num()= 36030 results in 100030
#define HHMMSS(t)
^ ((t/3600)*10000) + (((t\3600)/60)*100) + ((t\3600)\60)
|This returns the seconds for given hour, minute and second (expl. User input)
|Usage: long = SECONDS(10, 00, 00) |10 am = 36000 Seconds
#define SECONDS(h, m, s)
^ ((h*3600) + (m*60) + s)
/lakoon