19 lines
696 B
Plaintext
19 lines
696 B
Plaintext
theDate$ = "March 7 2009 7:30pm EST"
|
|
|
|
monthName$ = "January February March April May June July August September October November December"
|
|
for i = 1 to 12
|
|
if word$(theDate$,1) = word$(monthName$,i) then monthNum = i ' turn month name to number
|
|
next i
|
|
d = val(date$(monthNum;"/";word$(theDate$,2);"/";word$(theDate$,3))) ' days since Jan 1 1901
|
|
t$ = word$(theDate$,4) ' get time from theDate$
|
|
t1$ = word$(t$,1,"pm") ' strip pm
|
|
t2$ = word$(t1$,1,":") + "." + word$(t1$,2,":") ' replace : with .
|
|
t = val(t2$)
|
|
if right$(t$,2) = "pm" then t = t + 12
|
|
ap$ = "pm"
|
|
if t + 12 > 24 then
|
|
d = d + 1 ' if over 24 hours add 1 to days since 1/1/1901
|
|
ap$ = "am"
|
|
end if
|
|
print date$(d);" ";t1$;ap$
|