Hello, guys,
How to do DateDiff(), as you remember, a powerful and nice VB function, in
c#.net? I could not find this funciton.
Thanks a lot. 5 18820
Hello,
you can just subtract two dates from one another and you'll get a TimeSpan
instance.
dim diff as TimeSpan
diff = DateTime.Now - DateTime.Today
Best regards,
Henning Krause
"Andrew" <An****@discussions.microsoft.comwrote in message
news:48**********************************@microsof t.com...
Hello, guys,
How to do DateDiff(), as you remember, a powerful and nice VB function, in
c#.net? I could not find this funciton.
Thanks a lot.
Henning,
Is that not something as,
in C#
TimeSpan GiveTheTimeOfTheDay = DateTime.Now - DateTime.Today;
In VB
GiveTheTimeOfTheDay as TimeSpan = Now - DateTime.Today
:-)
is enough,
I know it is a sample, but I wanted to show you that in VB Now is enough to
write.
Cor
Will that give any difference
"Henning Krause [MVP - Exchange]" <ne***************@this.infinitec.de>
schreef in bericht news:O1*************@TK2MSFTNGP02.phx.gbl...
Hello,
you can just subtract two dates from one another and you'll get a TimeSpan
instance.
dim diff as TimeSpan
diff = DateTime.Now - DateTime.Today
Best regards,
Henning Krause
"Andrew" <An****@discussions.microsoft.comwrote in message
news:48**********************************@microsof t.com...
>Hello, guys,
How to do DateDiff(), as you remember, a powerful and nice VB function, in c#.net? I could not find this funciton.
Thanks a lot.
Cor Ligthert [MVP] <no************@planet.nlwrote:
Is that not something as,
in C#
TimeSpan GiveTheTimeOfTheDay = DateTime.Now - DateTime.Today;
In VB
GiveTheTimeOfTheDay as TimeSpan = Now - DateTime.Today
:-)
is enough,
I think I'd still rather read:
TimeSpan giveTheTimeOfTheDay = DateTime.Now.TimeOfDay;
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Well,
the original question was not how to get the time of the day but rather to
get the difference between two dates.
I simply used DateTime.Now and DateTime.Today as two example dates...
Best regards,
Henning Krause
"Jon Skeet [C# MVP]" <sk***@pobox.comwrote in message
news:MP*********************@msnews.microsoft.com. ..
Cor Ligthert [MVP] <no************@planet.nlwrote:
>Is that not something as,
in C# TimeSpan GiveTheTimeOfTheDay = DateTime.Now - DateTime.Today; In VB GiveTheTimeOfTheDay as TimeSpan = Now - DateTime.Today
:-)
is enough,
I think I'd still rather read:
TimeSpan giveTheTimeOfTheDay = DateTime.Now.TimeOfDay;
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Well heck Cor, you should have taken it all the way
Dim GiveTheTimeOfTheDay as TimeSpan = Now - Today
:-)
Kelly
Cor Ligthert [MVP] wrote:
Henning,
Is that not something as,
in C#
TimeSpan GiveTheTimeOfTheDay = DateTime.Now - DateTime.Today;
In VB
GiveTheTimeOfTheDay as TimeSpan = Now - DateTime.Today
:-)
is enough,
I know it is a sample, but I wanted to show you that in VB Now is enough to
write.
Cor
Will that give any difference
"Henning Krause [MVP - Exchange]" <ne***************@this.infinitec.de>
schreef in bericht news:O1*************@TK2MSFTNGP02.phx.gbl...
>Hello,
you can just subtract two dates from one another and you'll get a TimeSpan instance.
dim diff as TimeSpan
diff = DateTime.Now - DateTime.Today
Best regards, Henning Krause
"Andrew" <An****@discussions.microsoft.comwrote in message news:48**********************************@microso ft.com...
>>Hello, guys,
How to do DateDiff(), as you remember, a powerful and nice VB function, in c#.net? I could not find this funciton.
Thanks a lot.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: CJM |
last post by:
I have an ASP page that lists files and folders in a directory. I'm using a
cookie to record the last time this page was visited, and I intend to show
links that are created/modified from that date...
|
by: inamori |
last post by:
I face that problems
07/01/2003 06/30/2006 ---------> it should be 3
01/01/2003 02/28/2005 --------->could i get 2 years and 2 months
01/01/2003 03/01/2005 ...
|
by: Lofty |
last post by:
Hi all.
I have to write an app that interacts with mySQL (I really must have done
some evil, evil stuff in a previous life to be landed with this!)
I need to work out the difference in days...
|
by: intl04 |
last post by:
I'm trying to set up a query that will include a new field ('Days
until completion') whose value is derived from the DateDiff function.
I think I have the syntax correct but am not sure.
Days...
|
by: Paolo |
last post by:
I am having some problem with a Year Function.
I have form on which I have 4 field which indicate dates and an
additional form which sums those dates:
These are the fields:
YEARS...
|
by: PMBragg |
last post by:
ORINGINAL Post
>Thank you in advance. I'm trying to pull all inventory items from December
>of the previous year back to 4 years for my accountant. I know this can be
>done, but I'm drawing a...
|
by: Adrian |
last post by:
I hit on this problem converting a VB.NET insurance application to C#.
Age next birthday calculated from date of birth is often needed in
insurance premium calculations.
Originally done using...
|
by: sr |
last post by:
Anyone know of a better way to simulate a datediff for C#, i.e.,
without referencing the VB.NET runtime?
Only added the functionality that was needed for me so it is not
the full implementation...
|
by: kevinjwilson |
last post by:
I am trying to get the date difference between two dates but I don't
want the function to include weekends in the calculation. Does anyone
have an idea on how to make this work?
|
by: muddasirmunir |
last post by:
i am using vb 6 , i had place two datepicker in form now i want to calcuate differcen of month in two date for this i used the function datediff
i had try it withh many syntax but getting error...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
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...
|
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...
|
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,...
|
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,...
|
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...
| |