'************************************** ' Name: Countdown Till Midnight ' Description:' This code will show you ' the time remaining till midnight in a ma ' nner of a countdown watch. ' This is accomplished by using 2 lines ' of code only. ' By: PAIK ' ' ' Inputs:None ' ' Returns:None ' 'Assumes:None ' 'Side Effects:None '************************************** ' All what you will need is to put a Lab ' el on a form and a Timer ' Set the timer: interval to 500 ; ' and paste this code. ' Note: For best results of display use ' the font DigifaceWide for your added Lab ' el. '/////////////////////////////////////// ' //////////////////////////////////////// ' //////////////////////////////////////// ' //////////////////////////////////////// ' /////////////// ' Explanation of the used function: Foma ' t(Datediff ("n", now ,date+1 ) - time , ' "hh:nn:ss") '--------------------------------------- ' ---------------------------------------- ' ---------------------------------------- ' -------------------------- ' DatediffReturns the number of interval ' s between two dates. ' "n"Argument used to specify Minutes (y ' ou could use: "s" for seconds, "h" for h ' ours; "d" for days; ... ' now Used to specify current date and t ' ime ' date + 1Date (is the current date) (+1 ' ) means add 1 day to the current day => ' tomorrow ' time Used to specify the current time ' FormatDisplay the output in the specif ' ied format {in our case: "hh:nn:ss" hour ' :minutes:seconds '--------------------------------------- ' ---------------------------------------- ' ---------------------------------------- ' -------------------------- Label1.caption = Fomat(Datediff ("n", now ,date+1 ) - time , "hh:nn:ss") ' Check if you reached midnight and fire ' a message. If Format(DateDiff("n", Now, Date + 1) - Time, "hh:nn:SS") <= "00:00:01" Then MsgBox "Midnight Is Now!!!!", vbInformation + vbOKOnly, "Countdown till midnight"