I need to specify a new data type, almost entirely a 'clone' of the
existing DateTime type, with the following specific difference, and all
the consequent differences in properties and methods which this one
change implies.
The day immediately before Thursday September 14, 1752 should be
reported as Wednesday September 2, 1752, and so on, for all earlier
dates. Note that this change not only disrupts the steady sequence of
'one day at a time', but also breaks the mapping of Date on to
DayoftheWeek for all earlier dates, and Date on to DayoftheMonth and
DayoftheYear for earlier dates in 1752.
This is what actually occurred historically in the UK (and, I believe,
in North America) when the Gregorian calendar was finally adopted here.
I note that, since DateTime is a Value Type rather than a Reference
Type, I can neither inherit from it nor build a Class based on it. So it
would seem that a Structure has got to be the way to go. But I am not at
all sure of the detailed steps in building this, and getting it to work
as required.
Should this structure contain one or more (hidden) DateTime elements, to
facilitate use and adaptation of the existing properties and methods of
the underlying data type?
Would my structure be able to use the existing DateTime formatting
options once it has been built?
--
Alan M Dunsmuir 13 4180
Alan,
A datetime is actual a value that contains ticks from a certain start date
(which differs by instance when it is from a server or is internally).
You use methods to show that and to manipulate.
One of them is
DateTime.AddDay s(-x), what is maybe the most properiate for you to use in a
routine.
Cor
In message <um************ *@TK2MSFTNGP15. phx.gbl>, Cor Ligthert
<no************ @planet.nl> writes A datetime is actual a value that contains ticks from a certain start date (which differs by instance when it is from a server or is internally).
This would not solve the problem of the correct determination of the day
of the week, for dates prior to September 14, 1752. Nor would it
calculate correctly the number of days between two supplied dates.
--
Alan M Dunsmuir
Cor, A datetime is actual a value that contains ticks from a certain start date (which differs by instance when it is from a server or is internally).
A datetime is actually a value that contains "100-nanosecond units called
ticks, and a particular date is the number of ticks since 12:00 midnight,
January 1, 1 A.D. (C.E.) in the GregorianCalend ar calendar." http://msdn.microsoft.com/library/de...ClassTopic.asp
Notice it explicitly states that it is an instace from a specific point of
time.
This should not be confused with Local Time & Universal Time. Universal Time
is based on GMT, while Local Time is based your current local. In both cases
the value is represented by "the number of ticks since 12:00 midnight,
January 1, 1 A.D. (C.E.)"
Hope this helps
Jay
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:um******** *****@TK2MSFTNG P15.phx.gbl... Alan,
A datetime is actual a value that contains ticks from a certain start date (which differs by instance when it is from a server or is internally).
You use methods to show that and to manipulate.
One of them is
DateTime.AddDay s(-x), what is maybe the most properiate for you to use in a routine.
Cor
Alan,
Unfortunately because DateTime is a Structure you cannot extend (inherit
from) it.
Depending on the actual requirements for a different DateTime, I would:
- Introduce a Foreign Method http://www.refactoring.com/catalog/i...ignMethod.html
- Define a "MyDateTime " Type that behaved correctly (more then likely a
Structure, but might be a Class)
- Introduce Local Extension http://www.refactoring.com/catalog/i...Extension.html
- Create a custom System.Globaliz ation.Calendar (attempting to understand
the limitations of doing so).
- Create a custom ICustomFormatte r or IFormatProvider to adjust formatting
as needed...
Hope this helps
Jay
"Alan M Dunsmuir" <al**@moonrake. demon.co.uk> wrote in message
news:xp******** ******@moonrake .demon.co.uk... I need to specify a new data type, almost entirely a 'clone' of the existing DateTime type, with the following specific difference, and all the consequent differences in properties and methods which this one change implies.
The day immediately before Thursday September 14, 1752 should be reported as Wednesday September 2, 1752, and so on, for all earlier dates. Note that this change not only disrupts the steady sequence of 'one day at a time', but also breaks the mapping of Date on to DayoftheWeek for all earlier dates, and Date on to DayoftheMonth and DayoftheYear for earlier dates in 1752.
This is what actually occurred historically in the UK (and, I believe, in North America) when the Gregorian calendar was finally adopted here.
I note that, since DateTime is a Value Type rather than a Reference Type, I can neither inherit from it nor build a Class based on it. So it would seem that a Structure has got to be the way to go. But I am not at all sure of the detailed steps in building this, and getting it to work as required.
Should this structure contain one or more (hidden) DateTime elements, to facilitate use and adaptation of the existing properties and methods of the underlying data type?
Would my structure be able to use the existing DateTime formatting options once it has been built? -- Alan M Dunsmuir
Jay,
I know what you wrote, have a look at this, where my message talks as well
about.
(Before you write it, I know that you know that page as well, however to
make it clear what I mean). http://msdn.microsoft.com/library/de...da-db_9xut.asp
Because the problem is about calendars, do I not write about the exact
behaviour of the maybe used tick or whatever we name it.
I hope this helps
Cor
Cor, http://msdn.microsoft.com/library/de...da-db_9xut.asp
The topic you give discusses Transact SQL, as hopefully you realize Transact
SQL datetime is *not* the same as System.DateTime .
Even in locals that use a different System.Globaliz ation.Calendar object
(such as the HebrewCalendar or KoreanCalendar) the DateTime the value is
*still* represented by "the number of ticks since 12:00 midnight, January 1,
1 A.D. (C.E.)".
Universal Time & Local Time, as well as Globalization.C alendar simply change
the presentation/display/parsing of the DateTime value, not its internal
representation.
Hope this helps
Jay
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. Jay,
I know what you wrote, have a look at this, where my message talks as well about. (Before you write it, I know that you know that page as well, however to make it clear what I mean).
http://msdn.microsoft.com/library/de...da-db_9xut.asp
Because the problem is about calendars, do I not write about the exact behaviour of the maybe used tick or whatever we name it.
I hope this helps
Cor
Jay, The topic you give discusses Transact SQL, as hopefully you realize Transact SQL datetime is *not* the same as System.DateTime .
Exactly therefore I answered in the way I did, trying to show that there are
more DateTime values.
Although the OP did not speak about that, it is for me as well obvious that
the OP is talking about the system.DateTime . However I did not explicitly
directly wanted react on that what I expected.
And the rest is exactly as you wrote, therefore I answered the OP in the way
I did and showed the calendar property page on which is a lot of information
about that. I hope you did not miss that.
Cor
Cor,
(shakes head). Again these comments don't really warrant a response either.
The OP stated in the subject "a variant of the DateTime data type needed in
VB.NET". Notice he specifically stated "in VB.NET"!
Hope this helps
Jay
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. Jay,
The topic you give discusses Transact SQL, as hopefully you realize Transact SQL datetime is *not* the same as System.DateTime .
Exactly therefore I answered in the way I did, trying to show that there are more DateTime values.
Although the OP did not speak about that, it is for me as well obvious that the OP is talking about the system.DateTime . However I did not explicitly directly wanted react on that what I expected.
And the rest is exactly as you wrote, therefore I answered the OP in the way I did and showed the calendar property page on which is a lot of information about that. I hope you did not miss that.
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Frank Rizzo |
last post by:
Any ideas?
|
by: I am Sam |
last post by:
I have created this DateTime object and instanced it I think correctly
DateTime myClubNow1=new
DateTime(DateTime.Now.Year,DateTime.Now.Month,DateTime.Now.Day,DateTime.Now.Hour,DateTime.Now.Minute,DateTime.Now.Second);
I keep getting the below error:
Object reference not set to an instance of an object.
I don't know what the problem could be. Can someone help me with this? It
|
by: Reny J Joseph Thuthikattu |
last post by:
Hi,
I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a
miniute to it.How can i do that?
by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004
12:00 AM'
How do i do that?
Reny
---
|
by: Cor Ligthert |
last post by:
Hello everybody,
Jay and Herfried are telling me every time when I use CDate that using the
datetime.parseexact is always the best way to do String to datetime
conversions. They don't tell why only that I have to listen to them because
they know it better.
They told also that in a business situation it is better to use
datetime.parseexact for changing cultures and not to use the globalization
setting. I did not give them this sample,...
|
by: ns21 |
last post by:
Our application is windows desktop application. We are using VS.Net 2003, C#,
Framework 1.1, SQL 2000. We use webservices to add/update/select objects. We
are using XML Serialization. Following is a sample object at CLIENT
public System.DateTime ContactDateTime
{
get { return _ContactDateTime; }
set { _ContactDateTime = value; }
}
| |
by: Ulrich Hobelmann |
last post by:
Hi, slowly transitioning from C to C++, I decided to remodel a
struct/union (i.e. type identifier as first field, union of variant
types) as a class + subclasses. Switching functions are replaced by
virtual functions. So far so good.
Now what I used to do is have a struct, set its type and union member,
and return a pointer. I.e. I initialized the struct appropriately and
returned a reference. Now I'd like to do that in C++ (right...
|
by: Tracks |
last post by:
I have old legacy code from vb5 where data was written to a file with a
variant declaration (this was actually a coding error?)...
in vb5 the code was:
Dim thisdata as integer
Dim thatdata
Dim someother as integer
thatdata = ubound( Array1 )
|
by: G Gerard |
last post by:
Hello
If Variant type is the data type that contains any kind of data type is
there a reason why one would not always use Variant when declaring
variables?
Thanks
G Gerard
|
by: empire5 |
last post by:
I'm trying to convert a MS-Sql 6.5 VB application to SQL 2005 and vb.net.
The vb app has uses a variant data type. When I try to read the variant data
type from the sql 2005 database I get 8,000 characters into the variant
type, however when I use the 6.5 database I get only the limited number of
characters that are actually in the column.
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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: 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.
| |
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...
| |