What's new

Closed How to if condition date.time

Status
Not open for further replies.

m0stwanted143

Eternal Poster
Joined
Feb 8, 2016
Posts
925
Reaction
189
Points
310
Mga ka phcorner
Paano po ung
If (time 0 > 10:30)
{
Combobox.itemlist = "10:30am, 2:00pm, 4:30";
else if (time 10 30 > 2pm)
{
Combobox.itemlist = "2:00pm, 4:30pm";
{
else if (time 10 30 > 2pm)
{
Combobox.itemlist = " 4:30pm";
 
var timeNow= DateTime.Now;

ComboBox.Items.Clear();

if(timeNow.Hour>0&&timeNow.Hour<10&&timeNow.Min<30)
{
ComboBox.Items.Add(new DateTime(0,0,0,10,30,0).ToShortTimeString());
ComboBox.Items.Add( new DateTime( 0, 0, 0, 14, 0, 0 ).ToShortTimeString());
ComboBox.Items.Add(new DateTime(0, 0, 0, 16, 30, 0).ToShortTimeString());
}
else if(timeNow.Hour>10&&timeNow.Minute>30&&timeNow.Hour<14)
{
//place combobox items here tignan mo nalang ung sa 1st
}

d ko alam ung condition sa last kase same sa 2nd condition.
 
Last edited:
var timeNow= DateTime.Now;

ComboBox.Items.Clear();

if(timeNow.Hour>0&&timeNow.Hour<10&&timeNow.Min<30)
{
ComboBox.Items.Add(new DateTime(0,0,0,10,30,0).ToShortTimeString());
ComboBox.Items.Add( new DateTime( 0, 0, 0, 14, 0, 0 ).ToShortTimeString());
ComboBox.Items.Add(new DateTime(0, 0, 0, 16, 30, 0).ToShortTimeString());
}
else if(timeNow.Hour>10&&timeNow.Minute>30&&timeNow.Hour<14)
{
//place combobox items here tignan mo nalang ung sa 1st
}

d ko alam ung condition sa last kase same sa 2nd condition.
Ako na bahala paps. Salamat sa info. 😊 gagayahin ko na lng ung code mo sa 2nd condition sa 3rd ko .. Hahaha di ko kasi nakita dapat 2 to 4 30 pm yan alam ko
 
Status
Not open for further replies.
Back
Top