473,788 Members | 3,078 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3588
On 19 Sep 2005 18:03:36 -0700, "Jcs_5920" <jc******@cox.n et> 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.ms dos.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.l earn.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.programmi ng", 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.programmi ng", 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
816
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
3583
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 running windows 2000 service pack 4, .NET v1.1.
6
4213
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." Is there a way to make sure that the date header is sent over or a way to work around this exception? Here's a sample of the code:
15
18895
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 the value in timeonly format by using this command Format(now,"HH:mm:ss") But when I insert it into the Sql Server database, it embadded date value with it. the output looks like that "01/01/1900 08:59:00" in that case time is
29
9135
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 example is: 36,525 represents 01/01/1900. The starting point date is considered to be : 00/00/0000. I have looked thru Help and used Google and have not really found an answer. I know that Leap Years need to be accounted for too. Any...
1
7959
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 - 01/March/2006 Maximum Date - 31/March/2006
7
4494
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. Indeed I have verified that if I go to a website in Taiwan and save the file in BIG5 and then just load / save the file with a UTF8 text reader / write some bytes are modified. How can I correct this? It was my understanding the UTF8 was...
7
14136
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 environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Paris' for '2.0/DST' instead.
1
5229
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 Encryption (encoding) Given a message to send, we use the following table of letter to integer conversion to perform the encoding: a, A=0 b, B=1 c, C=2 d, D=3 e, E=4 f, F=5 g, G=6 h, H=7 i, I=8 j, J=9 k, K=10 l, L=11 m, M=12 n, N=13 o, O=14 p,...
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10172
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7517
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.