Hi all,
In a program I am writing, I need to convert a date stored as an
integer number of days into a standard gregorian format, with day zero
being 1/1/1800. Can anyone help me with this?
Bryan Jones
NightDaemon Enterprises
nightdaemon.co. nr 9 1782
"Se'noj" <tl******@gmail .com> wrote... In a program I am writing, I need to convert a date stored as an integer number of days into a standard gregorian format, with day zero being 1/1/1800. Can anyone help me with this?
So, what's really stopping you? Every year is 365 except the leap ones,
which are 366. Now, the number of days in your date, where is it counted
from?
Se'noj wrote: In a program I am writing, I need to convert a date stored as an integer number of days into a standard gregorian format, with day zero being 1/1/1800. Can anyone help me with this?
cal 1 1800
January 1800
Su Mo Tu We Th Fr Sa
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
26 27 28 29 30 31
I used Google http://www.google.com/
to search for
+"C++" +"Gregorian date"
and I found lots of stuff.
Victor Bazarov wrote: So, what's really stopping you? Every year is 365 except the leap ones, which are 366. Now, the number of days in your date, where is it counted from?
only nearly :-) every 100 hundred years the leap day is dropped, but there
are also exception (every 400 years I think), so 2000 was a leap year
Micha wrote: Victor Bazarov wrote:
So, what's really stopping you? Every year is 365 except the leap ones, which are 366. Now, the number of days in your date, where is it counted from?
only nearly :-) every 100 hundred years the leap day is dropped, but there are also exception (every 400 years I think), so 2000 was a leap year
Perhaps you misunderstand what "leap" means, Micha? It means the year
has an extra day, thus making a leap, a jump, to catch up with the true
solar year. Did you misread what I wrote? I didn't say "every fourth
year has an extra day", did I? So, nothing "nearly" about what I wrote.
"Micha" <mi*****@fantas ymail.de> wrote in message
news:cm******** **@schlund.de.. . Victor Bazarov wrote:
So, what's really stopping you? Every year is 365 except the leap ones, which are 366. Now, the number of days in your date, where is it
counted from?
only nearly :-) every 100 hundred years the leap day is dropped, but there are also exception (every 400 years I think), so 2000 was a leap year
Yes, there are several rules for determining which years
are leap years, but this doesn't change the fact Victor
cited: leap years contain 366 days.
You can google for the calculation rules.
-Mike
Victor Bazarov wrote: Perhaps you misunderstand what "leap" means, Micha? It means the year has an extra day, thus making a leap, a jump, to catch up with the true solar year. Did you misread what I wrote? I didn't say "every fourth year has an extra day", did I? So, nothing "nearly" about what I wrote.
indeed my german is a little bit better than my english - although I know
what "leap" means (and I think the original poster also knows that there
are leap years)
but what I ment was, that even if I know that there are leap years, it isn't
obviously easy to catch all exceptions; so why invent such a boring
algorithm myself, if there is surely somebody out there who has already
done it with a nice little piece of code?
Micha wrote: [...] but what I ment was, that even if I know that there are leap years, it isn't obviously easy to catch all exceptions; so why invent such a boring algorithm myself, if there is surely somebody out there who has already done it with a nice little piece of code?
Let me get this straight. When you said (and I quote):
"only nearly :-) every 100 hundred years the leap day is dropped,
but there are also exception (every 400 years I think), so 2000
was a leap year"
you actually meant "don't reinvent the wheel"? Fascinating!
"Victor Bazarov" wrote: [...] but what I ment was, that even if I know that there are leap years, it isn't obviously easy to catch all exceptions; so why invent such a boring algorithm myself, if there is surely somebody out there who has already done it with a nice little piece of code?
Let me get this straight. When you said (and I quote):
"only nearly :-) every 100 hundred years the leap day is dropped, but there are also exception (every 400 years I think), so 2000 was a leap year"
you actually meant "don't reinvent the wheel"? Fascinating!
LOL
"Mike Wahler" <mk******@mkwah ler.net> wrote in message news:<sh******* **********@news read3.news.pas. earthlink.net>. .. "Micha" <mi*****@fantas ymail.de> wrote in message news:cm******** **@schlund.de.. . Victor Bazarov wrote:
So, what's really stopping you? Every year is 365 except the leap ones, which are 366. Now, the number of days in your date, where is it counted from? only nearly :-) every 100 hundred years the leap day is dropped, but there are also exception (every 400 years I think), so 2000 was a leap year
Yes, there are several rules for determining which years are leap years, but this doesn't change the fact Victor cited: leap years contain 366 days.
You can google for the calculation rules.
int year;
//...
bool leap = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0);
-Mike
--
Marcelo Pinto This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Niall Porter |
last post by:
Hi all,
I'm building an ASP app on a Windows 2000/IIS machine which interfaces
with our SQL Server 2000 database via OLE DB.
Since we're based in the UK I want the users to be able to type in
dates in UK date format to input into the database. In Enterprise
Manager on the SQL Server I can manually enter a record into a table
and just type in a UK date (MM/DD/YYYY e.g. 25/12/2004) and it accepts
it happily.
|
by: Dennis M. Marks |
last post by:
What is the maximum valid date range for the date(yyyy,mm,dd) function.
--
Dennis M. Marks
http://www.dcs-chico.com/~denmarks/
Replace domain.invalid with dcsi.net
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
|
by: Fraser Ross |
last post by:
Does Boost have anything for doing a conversion of rate for a data sequence?
E.g. sound sample data from 44100 per second to 50000. I don't expect the
algorithm would be big. I standard algorithm would be useful of course.
Fraser.
|
by: David W. Fenton |
last post by:
A client is panicking about their large Access application, which
has been running smoothly with 100s of thousands of records for
quite some time. They have a big project in the next year that will
lead to a lot of use of the database and the adding of quite a lot
of new data (though I can't conceive of them adding more than than
10s of thousands of records, which won't change the current
performance profile at all).
If there is a SQL...
|
by: jshanman |
last post by:
I am writing a timeline that uses Google Maps. I have a function that
converts a date time to latitude coords. This function is used to draw
the markers on the timeline. I need a reverse function to convert a
latitude coord back to an accurate date time. Then I could detect the
day/hour in the viewport when the timeline is zoomed in or out, or if
it is moved. I cannot use the javascript date functions because this
timeline will...
| |
by: melissa.nava |
last post by:
Here is my code:
*****
Public Property DOB() As Date
Get
Try
DOB = (msBirthMonth + "/" + msBirthDay + "/" +
msBirthYear)
|
by: SSG |
last post by:
How to insert date to the sql server database.
I am getting input from the HTML form and store it to database using
ASP.
how to store date field, what datatype needed and what conversion
needed.
Thanx & Regards,
SSG
|
by: user |
last post by:
Hi,
Let's say I have 2 dates in the b/m format:
Date 1 and date 2
How do I check whether Date2 is later than Date 1?
Date1. 21-Nov-2006 09:00:00 PM
|
by: vinodtr |
last post by:
Hi all,
I have a date which is represented by the number of milliseconds since January 01, 1970. I need to change this back to DATE format. Is there any built in function in DB2 to do the needed conversion ?
In Oracle i was able to do the conversion by the following statement.
select to_char(to_date('01/01/1970','mm/dd/yyyy'),'mm/dd/yyyy') + milliseconds/86400000) from dual;
Note: In the above sql statement, milliseconds is the no:...
|
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...
|
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...
| |
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |