Handling some universal functions (VB) (www.jojoo.net) (www.jojoo.net) (please double-click the automatic scroll to watch, click Stop, and then hit ..)
'Uses the timeespan method to subtract a certin number of days
Function date1 ()
DIM NewTime As datetime
NewTime = datetime.now.subtract (New TimeSpan (7, 0, 0, 0)))
NEWTIME = NewTIME.FORMAT ("mm / dd / yyyy", datetimeformatinfo)
Response.write (NewTime)
END FUNCTION
'Uses the adddays method to subtract x Number of dayspublic function date2 () DIM newtime as datetimenewtime = datetime.now.addday (-7) DIM S AS STRING = NewTimeRereturn Send Function
'Thanks to Paul Czywczynski for this idea'This probably (In My opinion) Offers the most flexibility found so far'Change where the MM / dd / yyyy to whatever'response.write (System.String.Format ( "{0: d } ", Newtime) 'Would Return Just the name of the dayfunction date3 () DIM newTime as datetime = now.adddays (-7) response.write (system.string.format (" {0: mm / dd / yyyy} ", Newtime) End Function
Function date4 () DIM newtime as datetimenewtime = now.adddays (-7) Return NewTime.toString () End Function
'Uses the TolongTimeString Methodpublic Function Date5 () DIM NewTime As DateTimeNewTime = Now () Return NewTime.tolongTimeString () End Function
'Uses the toshorttimeString methodpublic function date6 () DIM newtime as datetimentnewtime = now () return newtime.toshostTimeString () End Function
'Uses the tolongdatestring methodpublic function date7 () DIM newtime as datetimenewtime = now () return newtime.tolongdateString () End Function
'Uses the toshortdatestring methodpublic function date8 () DIM newtime as datetimentnewtime = now () return newtime.toshortdateString () End Function
'Uses FormatDateTime function General formatFunction Date9 () Dim NewTime as DateTimeNewTime = DateTime.Now.Subtract (New TimeSpan (7, 0, 0, 0)) return formatdatetime (NewTime, 0) End Function'Uses FormatDateTime function LongDate formatFunction Date10 () Dim newtime as datetimentime = datetime.now.subtract (New Timespan (7, 0, 0, 0)) Return Formator (NewTIME, 1) End Function
'Uses formatDatetime function shortdate formatfunction date11 () Dim newtime as datetiment11 = datetime.now.subtract (New Timespan (7, 0, 0, 0)) Return Formator (NewTime, 2) end function
'Uses formatDatetime function12 () Dim nexttime as datetiment12 (DATETIME.NOW.SUBTRACT (New Timespan (7, 0, 0, 0)) Return Formator (NewTime, 3) End Function
'Uses formatDatetime function shorttime formatfunction date13 () Dim newtime as datetiment13 = datetime.now.subtract (New Timespan (7, 0, 0, 0)) Return Formator (NewTIME, 4) End Function
'Bring back just the name of the dayfunction date14 () DIM newtime as datetime = now.adddays (-7) DIM S AS STRINGS = (System.String.Format ("{0: DDD}", newtime) Return Send Function
'Returns the in what day day of weekfunction date15 () DIM mydate as datetimedim myweekday as infermydate = now.adddays (-5) MyWeekDay = Weekday (MyDate) Return Myweekdayend Function
'Returns the Month IntegerFunction Date16 () DIM MyDate As DateTimedim MyMonth As INTEGERMYDATE = NOW.ADDDAYS (-5) MyMONTH = MONTH (MyDate) Return MyMonthend Function