# Date conversion

Discussion in 'ASP .Net' started by Piotr Karwatka, Nov 11, 2004.

1. ### Piotr KarwatkaGuest

Hi!

I have a little problem - i have an integer value with contain a number of
some day in current day (for example 56) - and my problem is - how can i
caonvert this integer value to DateTime (for example 33 = 02.02.2004)? I
want to reverse function to DateTime.DaysOfYear

Thanks

--
Pozdrawiam serdecznie!

--
Piotr Karwatka
-- ,
-- http://amigo.pop.pl

Piotr Karwatka, Nov 11, 2004

2. ### ShivaGuest

May be like this?

// C#
DateTime x = new DateTime (DateTime.Now.Year, 1, 1);
// x now holds DateTime for <your day count>

"Piotr Karwatka" <> wrote in message
news:cmvrrp\$geb\$...
Hi!

I have a little problem - i have an integer value with contain a number of
some day in current day (for example 56) - and my problem is - how can i
caonvert this integer value to DateTime (for example 33 = 02.02.2004)? I
want to reverse function to DateTime.DaysOfYear

Thanks

--
Pozdrawiam serdecznie!

--
Piotr Karwatka
-- ,
-- http://amigo.pop.pl

Shiva, Nov 11, 2004

3. ### Hans KestingGuest

Piotr Karwatka wrote:
> Hi!
>
> I have a little problem - i have an integer value with contain a
> number of some day in current day (for example 56) - and my problem
> is - how can i caonvert this integer value to DateTime (for example
> 33 = 02.02.2004)? I want to reverse function to DateTime.DaysOfYear
>
> Thanks
>
> --
> Pozdrawiam serdecznie!

public DateTime ReverseDaysOfYear(int year, int days)
{
DateTime dt = new DateTime(year, 1, 1);
return dt;
}

Hans Kesting

Hans Kesting, Nov 11, 2004
4. ### Eliyahu GoldinGuest

Time interval is represenred by TimeSpan structure. You can create a
timespan for the number of days you need and than add it to an instance of
DateTime structure preset to to the beginning of the year.

Eliyahu

"Piotr Karwatka" <> wrote in message
news:cmvrrp\$geb\$...
> Hi!
>
> I have a little problem - i have an integer value with contain a number

of
> some day in current day (for example 56) - and my problem is - how can i
> caonvert this integer value to DateTime (for example 33 = 02.02.2004)? I
> want to reverse function to DateTime.DaysOfYear
>
> Thanks
>
> --
> Pozdrawiam serdecznie!
>
> --
> Piotr Karwatka
> -- ,
> -- http://amigo.pop.pl
>
>

Eliyahu Goldin, Nov 11, 2004
5. ### Piotr KarwatkaGuest

Thanks! That's that what i was looking for!

U¿ytkownik "Shiva" <> napisa³ w wiadomo¶ci
news:OPgOBo\$...
> May be like this?
>
> // C#
> DateTime x = new DateTime (DateTime.Now.Year, 1, 1);
> // x now holds DateTime for <your day count>
>
> "Piotr Karwatka" <> wrote in message
> news:cmvrrp\$geb\$...
> Hi!
>
> I have a little problem - i have an integer value with contain a number
> of
> some day in current day (for example 56) - and my problem is - how can i
> caonvert this integer value to DateTime (for example 33 = 02.02.2004)? I
> want to reverse function to DateTime.DaysOfYear
>
> Thanks
>
> --
> Pozdrawiam serdecznie!
>
> --
> Piotr Karwatka
> -- ,
> -- http://amigo.pop.pl
>
>
>

Piotr Karwatka, Nov 11, 2004