Calculating dates in .Net
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngmigrate' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

=?iso-8859-1?Q?Andr=E9_Colbi=F6rnsen?=
-- Moved from [aspngfreeforall] to [aspngmigrate] by Marcie Jones <Click here to reveal e-mail address> --

In asp.classic I could calculate a date like this:

Dim made

Made =3D rstemp.fields("changed")

IF month(now() - made) > 18 THEN
    IF month(now) <> month(made) THEN
        RESPONSE.write "<font color=3D'red'>" &
formatdatetime(made, vbshortdate) & "<br><br><b>OBS!</b>"
        RESPONSE.write GetText(aryElementText, "prodtab_item18")
& "</font>"
    ELSE
        RESPONSE.write formatdatetime(made, vbshortdate)
    END IF
ELSE
    RESPONSE.write formatdatetime(made, vbshortdate)
END IF

I have tried to find an easy way to do this in .Net but did not succeed
so far. Could somebody point me in the right direction?

Regards/H=E4lsningar

Andr=E9 Colbi=F6rnsen
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
Sonnenburg Communications
Bergsgatan 3,
SE-211 54 Malm=F6
Sweden
Tel.: +46-(0)40-97 78 80
Fax.: +46-(0)40-97 78 80
Mob.: +46-(0)708-97 78 79
Mail: Click here to reveal e-mail address
Web.: www.sonnenburg.se
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D

Reply to this message...
 
    
Marcie Jones (VIP)
Check out the following methods of DateTime variables in .Net:
Subtract, ToShortDateString

See docs:
ms-help://MS.NETFrameworkSDK/cpref/html/frlrfsystemdatetimememberstopic.h=
tm

Hope this helps!
Marcie

----- Original Message -----
From: =3D?iso-8859-1?Q?Andr=3DE9_Colbi=3DF6rnsen?=3D =
<Click here to reveal e-mail address>
To: Click here to reveal e-mail address
Sent: Wed, 13 Feb 2002 14:33:28 +0100
Subject: Calculating dates in .Net

-- Moved from [aspngfreeforall] to [aspngmigrate] by Marcie Jones =
<Click here to reveal e-mail address> --

In asp.classic I could calculate a date like this:

Dim made

Made =3D3D rstemp.fields("changed")

IF month(now() - made) > 18 THEN
    IF month(now) <> month(made) THEN
        RESPONSE.write "<font color=3D3D'red'>" &
formatdatetime(made, vbshortdate) & "<br><br><b>OBS!</b>"
        RESPONSE.write GetText(aryElementText, "prodtab_item18")
& "</font>"
    ELSE
        RESPONSE.write formatdatetime(made, vbshortdate)
    END IF
ELSE
    RESPONSE.write formatdatetime(made, vbshortdate)
END IF

I have tried to find an easy way to do this in .Net but did not succeed
so far. Could somebody point me in the right direction?

Regards/H=3DE4lsningar

Andr=3DE9 Colbi=3DF6rnsen
=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D=
3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D
=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D
Sonnenburg Communications
Bergsgatan 3,
SE-211 54 Malm=3DF6
Sweden
Tel.: +46-(0)40-97 78 80
Fax.: +46-(0)40-97 78 80
Mob.: +46-(0)708-97 78 79
Mail: Click here to reveal e-mail address
Web.: www.sonnenburg.se
=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D=
3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D
=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D=3D3D

Reply to this message...
 
 
System.DateTime




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com