473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Date encoding as integer please help

Hello All, I was reading some of the posts trying to learn about date
coding schemes used in old DOS programs with no luck, so I though I'd
ask the group for help.
These are the HEX values and corresponding dates I am using. If anyone
can help me figure out the encode / decode method I would really
appreciate it.
Date only, no time stored.
9C07 0B00 = 01-15-80
9D07 0B00 = 01-16-80
BB07 0B00 = 02-15-80
BC07 0B00 = 02-16-80
3D2C 0B00 = 09-17-05
3E2C 0B00 = 09-18-05

Please help, I'm new to programming & trying to learn on my own.
JCS

Sep 20 '05 #1
4 3567
On 19 Sep 2005 18:03:36 -0700, "Jcs_5920" <jc******@cox.net> wrote in
comp.lang.c++:
Hello All, I was reading some of the posts trying to learn about date
coding schemes used in old DOS programs with no luck, so I though I'd
ask the group for help.
These are the HEX values and corresponding dates I am using. If anyone
can help me figure out the encode / decode method I would really
appreciate it.
Date only, no time stored.
9C07 0B00 = 01-15-80
9D07 0B00 = 01-16-80
BB07 0B00 = 02-15-80
BC07 0B00 = 02-16-80
3D2C 0B00 = 09-17-05
3E2C 0B00 = 09-18-05

Please help, I'm new to programming & trying to learn on my own.
JCS


The C++ language defines a type named 'time_t' that represents times,
and does not define its representation, which varies from system to
system. If you are using a C++ compiler, you should be able to call
time() prototyped in the header <time.h> or <ctime> that will return a
time_t, and there are various functions that will convert it to text
for you.

On the other hand, if you are talking about something like the time
stamp format MS-DOS used on disk files, you need to ask in a platform
specific group. news:comp.os.msdos.programmer is the right place.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Sep 20 '05 #2
Jcs_5920 wrote:
Hello All, I was reading some of the posts trying to learn about date
coding schemes used in old DOS programs with no luck, so I though I'd
ask the group for help.
These are the HEX values and corresponding dates I am using. If anyone
can help me figure out the encode / decode method I would really
appreciate it.
Date only, no time stored.
9C07 0B00 = 01-15-80
9D07 0B00 = 01-16-80
BB07 0B00 = 02-15-80
BC07 0B00 = 02-16-80
3D2C 0B00 = 09-17-05
3E2C 0B00 = 09-18-05

Please help, I'm new to programming & trying to learn on my own.
JCS


The first-best clue is that only one digit is off between two
consecutive dates - the "9C..." to "9D..." from 1/15/80 to 1/15/80.
That tells me that it is probably a simple 32 bit "little endian" number.

If you buy that, then in more common "source code" format your numbers
look like:

0x000B079C for 1/15/80
0x000B079D for 1/16/80
0x000B07BB for 2/15/80
0x000B07BC for 2/16/80
0x000B2C3D for 9/17/05
0x000B2C3E for 9/18/05

I put 1/15/80 into an OpenOffice spreadsheet, then converted 0x0B079C to
decimal (722844). Subtracting ('cause I know spreadsheets keep dates as
numbers of days) gives me an "epoch" date of 12/18/0001. Go figure. A
sanity check shows that 0x0B2C3E is 732222 and that by adding that to
the epoch date we get 9/18/05...
Sep 20 '05 #3
"Jcs_5920" wrote:
Hello All, I was reading some of the posts trying to learn about date
coding schemes used in old DOS programs with no luck, so I though I'd
ask the group for help.
These are the HEX values and corresponding dates I am using. If anyone
can help me figure out the encode / decode method I would really
appreciate it.
Date only, no time stored.
9C07 0B00 = 01-15-80
9D07 0B00 = 01-16-80
BB07 0B00 = 02-15-80
BC07 0B00 = 02-16-80
3D2C 0B00 = 09-17-05
3E2C 0B00 = 09-18-05

Please help, I'm new to programming & trying to learn on my own.


A bit off-topic (should really go to a general programming
group such as "comp.programming", or maybe a DOS group such
as "comp.os.msdos.misc")...

.... but I see the answer, so I'll reply briefly.

The hex numbers on the left are days, in little-endian format.
Do the math: 000B2C3E(Hex) = 732222(Dec).
Divide by 365.25 and get 2004.7146 years, which is around
September 18 of a year which is 2004 years past some "base"
year. Hence that base year must have been the year 1AD.
(Which makes sense, because there was no year "0".)

So your encoding scheme is, "days since 1-1-1AD, in hex,
little-endian".

Which means DOS, under the surface, was sort-of Y2K compliant,
even though it only displayed 2-digit years. Interesting.

--
Cheers,
Robbie Hatley
Tustin, CA, USA
email: lonewolfintj at pacbell dot net
web: home dot pacbell dot net slant earnur slant
Sep 20 '05 #4
Thank you all soooo MUCH, I am still learning but this gives me
something to sink my teeth in.

p.s. sorry for being in the wrong group, like I said I am very new to
this.
Best wishes to all.

JCS
Robbie Hatley wrote:
"Jcs_5920" wrote:
Hello All, I was reading some of the posts trying to learn about date
coding schemes used in old DOS programs with no luck, so I though I'd
ask the group for help.
These are the HEX values and corresponding dates I am using. If anyone
can help me figure out the encode / decode method I would really
appreciate it.
Date only, no time stored.
9C07 0B00 = 01-15-80
9D07 0B00 = 01-16-80
BB07 0B00 = 02-15-80
BC07 0B00 = 02-16-80
3D2C 0B00 = 09-17-05
3E2C 0B00 = 09-18-05

Please help, I'm new to programming & trying to learn on my own.


A bit off-topic (should really go to a general programming
group such as "comp.programming", or maybe a DOS group such
as "comp.os.msdos.misc")...

... but I see the answer, so I'll reply briefly.

The hex numbers on the left are days, in little-endian format.
Do the math: 000B2C3E(Hex) = 732222(Dec).
Divide by 365.25 and get 2004.7146 years, which is around
September 18 of a year which is 2004 years past some "base"
year. Hence that base year must have been the year 1AD.
(Which makes sense, because there was no year "0".)

So your encoding scheme is, "days since 1-1-1AD, in hex,
little-endian".

Which means DOS, under the surface, was sort-of Y2K compliant,
even though it only displayed 2-digit years. Interesting.

--
Cheers,
Robbie Hatley
Tustin, CA, USA
email: lonewolfintj at pacbell dot net
web: home dot pacbell dot net slant earnur slant


Sep 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Macca | last post by:
Hi, I have a table which has a date/time field. I am storing them as follows :- 01/01/2005 11:25 01/01/2005 19:44 02/01/2005 05:04
1
by: Bernard | last post by:
Hello, Can someone please help me? We have developed a asp.net application which is working fine on 4 other computers. We have recently deplyed the application to the live environment...
6
by: Mike Koerner | last post by:
Hi, I am having problems setting the HttpWebRequest Date header. I understand that it is a restricted header and I do receive the "This header must be modified with the appropriate property." ...
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
29
by: james | last post by:
I have a problem that at first glance seems not that hard to figure out. But, so far, the answer has escaped me. I have an old database file that has the date(s) stored in it as number of days. An...
1
by: itsolutionsfree | last post by:
Hi All, i am deep trouble.so,please help me how to get minimum and maximum dates for particular Month and Year.Any kind of help will help. for ex: im passing : March 2006 Minimum Date -...
7
by: EmeraldShield | last post by:
We have an application that uses UTF8 everywhere to load / save / process documents. One of our clients is having a problem with BIG Encoded files being trashed after running through our app. ...
7
by: Ramon | last post by:
Hello, when I send an email using the mail() function, I get a Runtime Notice: date() : It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ...
1
by: Sadie | last post by:
please help me with the java codes for this problem i tried to do this program a week ago but even now i dont have an idea of how to go about with it. please help me it is urgent Cryptography ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.