Convert basis
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * How can I convert dates from * SPSS format (DD-MMM-YYYY HH:MM) to * ACCESS format (MM/DD/YYYY HH:MM:AM or PM)? * rlevesque@videotron.ca. DATA LIST LIST /date1(DATETIME26). BEGIN DATA '25-NOV-2000 13:15:00' '25-DEC-2000 05:17:00' '24-MAR-2000 02:02:00' '15-FEB-2000 12:01:00' END DATA. LIST. STRING datestr(A11) timestr(A8) date2(A19). COMPUTE datestr=STRING(date1,ADATE). DO IF XDATE.HOUR(date1)>11. COMPUTE timestr=CONCAT(STR(XDATE.TIME(date1),TIME5)," PM"). ELSE. COMPUTE timestr=CONCAT(STR(XDATE.TIME(date1),TIME5)," AM"). END IF. COMPUTE date2=CONCAT(datestr,timestr). VARIABLE WIDTH date1(18). VARIABLE LABEL date1 'SPSS format' date2 'ACCESS format'. EXECUTE. |
Related pages
...