Link to home
Start Free TrialLog in
Avatar of x_terminat_or_3
x_terminat_or_3

asked on

MSDOS time/date encoding in php

Hi all

I am trying to set the last modified date/time of individual files in a zip
file.

According to the specification (http://www.pkware.com/appnote.txt), date/time
are two bytes each, and use standard msdos date/time encoding.

Does anybody have a clue to this?


With kind regards


X_terminat_or_3 aka Ramses
Avatar of nicholassolutions
nicholassolutions
Flag of United States of America image

I think you meant http://www.pkware.com/company/standards/appnote/appnote.txt
As for your question, have a look here: http://www.koders.com/php/fidD3BCF0DFBAF5552FA267D1BDB6F0BF2E13DF2453.aspx
you might try contacting the guy at sourceforge about modifying the date
Also have a look here
http://www.zend.com/codex.php?id=696&single=1

sorry I cant be of more help,
Matt

Avatar of x_terminat_or_3
x_terminat_or_3

ASKER

Yeah that's the class I used as base to extend.

I don't have time to wait for the author to update his class, and I am quite capable of implementing the encoding once I get the details...
The url you posted www.koders.com does not work
ASKER CERTIFIED SOLUTION
Avatar of nicholassolutions
nicholassolutions
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks my man!

MS DOS Date Time Format

There is two additional data types witch place is here.  MS DOS Date format and MS DOS Time format.

MS-DOS date
A date in the format used by MS-DOS. The date is a packed 16-bit (2 bytes) value in which bits in the value represent the day, month, and year.

MS-DOS time
A time in the format used by MS-DOS. The time is a packed 16-bit (2 bytes) value in which bits in the value represent the hour, minute, and second.

so msdos date time is 32 bits (4 bytes - 2 bytes(16 bits) for time and 2 bytes for date)

first 16 bits ( 1st byte)

0-4 - seconds
5-10 - minutes
11-15 -hours


second 16 bits

16-20  day (1 -31)
21-24 month (1-12)
25-31 year ( number of years since 1980) ==> so you get a year by addin 1980 to value of this 4 bits





Thank you for your comment.  Sorry but it seems like you were just one minute too late....