Velocity Reviews > Date conversion

# Date conversion

Piotr Karwatka
Guest
Posts: n/a

 11-11-2004
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://www.velocityreviews.com/forums/(E-Mail Removed), (E-Mail Removed)
-- http://amigo.pop.pl

Shiva
Guest
Posts: n/a

 11-11-2004
May be like this?

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

"Piotr Karwatka" <(E-Mail Removed)> wrote in message
news:cmvrrp\$geb\$(E-Mail Removed)...
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
-- (E-Mail Removed), (E-Mail Removed)
-- http://amigo.pop.pl

Hans Kesting
Guest
Posts: n/a

 11-11-2004
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

Eliyahu Goldin
Guest
Posts: n/a

 11-11-2004
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" <(E-Mail Removed)> wrote in message
news:cmvrrp\$geb\$(E-Mail Removed)...
> 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
> -- (E-Mail Removed), (E-Mail Removed)
> -- http://amigo.pop.pl
>
>

Piotr Karwatka
Guest
Posts: n/a

 11-11-2004
Thanks! That's that what i was looking for!

Użytkownik "Shiva" <(E-Mail Removed)> napisał w wiadomości
news:OPgOBo\$(E-Mail Removed)...
> May be like this?
>
> // C#
> DateTime x = new DateTime (DateTime.Now.Year, 1, 1);
> // x now holds DateTime for <your day count>
>
> "Piotr Karwatka" <(E-Mail Removed)> wrote in message
> news:cmvrrp\$geb\$(E-Mail Removed)...
> 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
> -- (E-Mail Removed), (E-Mail Removed)
> -- http://amigo.pop.pl
>
>
>