;; ============================== ;; Script: msdate-to-date.r ;; downloaded from: www.REBOL.org ;; on: 28-Mar-2024 ;; at: 9:14:40.55503 UTC ;; ;; ============================== ;; ================================================== ;; email address(es) have been munged to protect them ;; from spam harvesters. ;; If you were logged on the email addresses would ;; not be munged ;; ================================================== REBOL [ Title: "msdate-to-date" Date: 3-Dec-2001/13:11:09+1:00 Version: 0.1.0 File: %msdate-to-date.r Author: "Oldes" Usage: "msdate-to-date #{27A6822B}" Purpose: {Converts standard MS DOS binary time to Rebol's one} Email: %oliva--david--seznam--cz library: [ level: none platform: none type: 'tool domain: 'file-handling tested-under: none support: none license: none see-also: none ] ] msdate-to-date: func[ "Converts standard MS DOS binary time to Rebol's" ms [binary! string!] "4bytes of MS DOS binary time" /local to-int y m d h mi s ][ ms: enbase/base head reverse ms 2 to-int: func[v][ insert/dup v "0" 8 - length? v to-integer debase/base head v 2 ] parse ms [ copy y 7 skip (y: 1980 + to-int y) copy m 4 skip (m: to-int m) copy d 5 skip (d: to-int d) copy h 5 skip (h: to-int h) copy mi 6 skip (mi: to-int mi) copy s 5 skip (s: 2 * to-int s) ] to-date rejoin [d "-" m "-" y "/" h ":" mi ":" s] ]