Suhail Kaleem » Page 4

Add 1 day to GETDATE()

1

GETDATE() function t-sql is used to get current systemdate and time

if you want to add 1 day to GETDATE() this is how you do it

select * from table where ProgrameDate >= Convert(VarChar(10), DATEADD(day, -1, GETDATE()), 101)

you can use DATEDIFF to subtract date from current date

the following table from MSDN lists functions available for datetime in t-sql

Function Determinism
DATEADD Deterministic
DATEDIFF Deterministic
DATENAME Nondeterministic
DATEPART Deterministic except when used as DATEPART (dw,date) or DATEPART (wk,ww, date ). dw, the weekday datepart, depends on the value that is set by SET DATEFIRST, which sets the first day of the week. The week (wk, ww) datepart reflects changes that are made to SET DATEFIRST. January 1 of any year defines the starting number for the week datepart, for example: DATEPART(wk,Jan 1, xxxx) = 1, where xxxx is any year.
DAY Deterministic
GETDATE Nondeterministic
GETUTCDATE Nondeterministic
MONTH Deterministic
YEAR Deterministic

jquery .click does not work

0

If you are adding a html dynamically  and then binding the .click event of an element  then this will not work

the .click event will never bind

in order to make the events works for the dynamic html or elements  use .live like below

$('#ElementID').live('click', function (event) {
if (event.button != 0) {
// left button - ignore it
return true;

} else {
//right button
var id = $(this).attr('id'); // do something

return false; // "capture" the click
}
});

Also you might have noticed that i have a check to see which button was clicked , because in  .live method left and right mouse buttons both  bind to click event unlike the .click event only right button is bind so we have to check in .live which button was clicked

Function to format dateTime to RSS 2 pubDate

0

The following vb.net function will format the date-time  to pubDate format for rss 2

Private Function BuildPubDate(ByVal d As Date) As String
Try
Dim RV As String
Dim day As String = d.Day.ToString
If day.Length = 1 Then day = "0" & day
Dim month As String = d.Month.ToString
Select Case month
Case "1"
month = "January"
Case "2"
month = "February"
Case "3"
month = "March"
Case "4"
month = "April"
Case "5"
month = "May"
Case "6"
month = "June"
Case "7"
month = "July"
Case "8"
month = "August"
Case "9"
month = "September"
Case "10"
month = "October"
Case "11"
month = "November"
Case "12"
month = "December"
End Select

Dim Mtime As String = ""
Dim mDate As Date = d.ToUniversalTime
If mDate.Hour.ToString.Length = 1 Then
Mtime = "0" & mDate.Hour.ToString
Else
Mtime = mDate.Hour.ToString
End If
Mtime += ":"
If mDate.Minute.ToString.Length = 1 Then
Mtime += "0" & mDate.Minute.ToString
Else
Mtime += mDate.Minute.ToString
End If
Mtime += ":"
If mDate.Second.ToString.Length = 1 Then
Mtime += "0" & mDate.Second.ToString
Else
Mtime += mDate.Second.ToString
End If

RV = d.DayOfWeek.ToString.Substring(0, 3)
RV += ", " & day & " " & month.Substring(0, 3)
RV += " " & d.Year.ToString & " " & Mtime & " GMT"
Return RV
Catch ex As Exception
Return ""
End Try
Go to Top