Hi!
I need to use if statement to check if its the summer time (CEST)
or Winter time (CET)...But I dunno how to do that..Couldn't find anything useful on the INTERNET.my date format is (d-mm-yyyy)
Basically I need to do sth like that

if DateTimePicker->Value>(31-10-yyyy) {time="CET";}

THX For help!

Recommended Answers

All 8 Replies

Create a DateTime object and use comparisons( <. >,==, etc.) with the current date:

DateTime vernalequinox(2011,03,21);
DateTime summersolstice(2011,06,21); //or whatever it is
if(DateTimePicker->Value >= vernalequinox && DateTimePicker->Value < summersolstice)
   MessageBox::Show("Spring!");

I'm not very familiar with CEST and CET, but I assume they change over on certain dates. You might have to change things around to match your date format, but this is the general idea.

Wow - Jonsca, You are awesome...That's the thing I was looking for!.
Thank You!
And thanks for Your patience, because You are teaching me almost everything here :)

hmm...is it possible to do universal function which will work for every year I pick up from the DateTimePicker object?..Or I need to make an if statement for every year

Phew..It starts to be more in more complicated...
CEST starts from last sunday of march (2:00AM)
CEST ends on last sunday of october (2:00AM)...
I think it will be hard to make function which will decide what Date I have picked up..
Probably I wont be able to automatize it..or maybe u have some other ideas?

hmmh...I've written sth like this:

bool IsDaylightSavingTime();
if (date_1->Value.IsDayLightSavingTime(date_1->Value))
			{MessageBox::Show("Spring!");}

but i recive error:
'IsDayLightSavingTime' : is not a member of 'System::DateTime'

I have one DateTimePicker (with only a date to pick) called date_1
and one DateTimePicker (with only a time to pick) called time_1
I dunno how to check IsDayLightSavingTime thing for them...

'Value' is of type System::DateTimethe IsDaylightSavingTime() is available in the TimeZone Class.
Hence you recieve an error.

Hmm I have tried for a while to use IsDayLightSavingTime...
Unfortunatelly I cannot make it work (to check if given date is in IsDayLightSavingTime or not)...
Can anybody help me?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.