MSDOS time/date encoding in php

Hi all

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

According to the specification (, 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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I think you meant
As for your question, have a look here:
you might try contacting the guy at sourceforge about modifying the date
Also have a look here

sorry I cant be of more help,

x_terminat_or_3Author Commented:
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...
x_terminat_or_3Author Commented:
The url you posted does not work
Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

Strange, it still works for me. This is the same code:

The stuff you want should be right at the top after the variable declarations: the unix2DosTime method and the addFile method.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
x_terminat_or_3Author Commented:
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

x_terminat_or_3Author Commented:
Thank you for your comment.  Sorry but it seems like you were just one minute too late....
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.