below query gives you the am/pm from table field "yourdate" and it gives in ascending order SELECT SUBSTRING(CONVERT(varchar(20), yourdate, 22), 18, 3) AS Expr1 FROM table ORDER BY expr1 ; SUBSTRING(CONVERT(varchar(20), yourdate, 22), 18, 3)-->it gives you a am/pm. o/p: ---- am pm am pm |
Saturday, January 8, 2011
Get am/pm from datetime in sql query
how to disable right click on images
this is script for disable right click on images for html pages.
<script language="JavaScript">
<script language="JavaScript">
var clickmessage="Right click disabled on images!"
function disableclick(e)
{
if (document.all)
{
if (event.button==2||event.button==3)
{
if (event.srcElement.tagName=="IMG")
{
alert(clickmessage);
return false;
}
}
}
else if (document.layers)
{
if (e.which == 3)
{
alert(clickmessage);
return false;
}
}
else if (document.getElementById)
{
if (e.which==3&&e.target.tagName=="IMG")
{
alert(clickmessage)
return false
}
}
}
function associateimages()
{
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}
if (document.all)
{
document.onmousedown=disableclick
}
else if (document.getElementById)
{
document.onmouseup=disableclick
}
else if (document.layers)
{
associateimages()
}
</script>
How to disable particular Day of a Week in ASP.Net Calendar control?
The below little code snippet will help you to do that by using DayRender event of Calendar control.
ASPX
<asp:Calendar ID="Calendar1" runat="server" ondayrender="Calendar1_DayRender"> </asp:Calendar>
CodeBehind
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date.DayOfWeek == DayOfWeek.Monday)
{
e.Day.IsSelectable = false;
}
}
ASPX
<asp:Calendar ID="Calendar1" runat="server" ondayrender="Calendar1_DayRender"> </asp:Calendar>
CodeBehind
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date.DayOfWeek == DayOfWeek.Monday)
{
e.Day.IsSelectable = false;
}
}
How to disable to select Weekends(Saturday and Sunday) in Calendar control in asp.net?
and here is a solution for that :)
.aspx
<asp:Calendar ID="Calendar1" runat="server" ondayrender="Calendar1_DayRender">
</asp:Calendar>
Code-behind
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.IsWeekend)
{
e.Day.IsSelectable = false;
}
}
.aspx
<asp:Calendar ID="Calendar1" runat="server" ondayrender="Calendar1_DayRender">
</asp:Calendar>
Code-behind
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.IsWeekend)
{
e.Day.IsSelectable = false;
}
}
How to convert String to Char[] and Char[] to String?
First, we see how to convert string to character Array
string str = "Hello World!";
char[] ch = str.ToCharArray();
now, we see how to convert character array to string:
string strtarget = new string(ch);
string str = "Hello World!";
char[] ch = str.ToCharArray();
now, we see how to convert character array to string:
string strtarget = new string(ch);
Get maximum date from two different columns in a new columnn
if you want to get maximum date from two different columns you can like this: select date1,date2,( (date1<date2)*date2 + (date2<date1)*date1 ) as maxdate from table1. if you want maximum date from field date1 and date2 and store into field date3 then you can use this formula: update table1 set date3= ( (date1<date2)*date2 + (date2<date1)*date1 ) |
give hyperlink of specific worksheet in another workbook
here i am showing how to give link of particular worksheet ( lets take sheet1) of workbook(workbook1)
in another workbook ( workbook2).
then in workbook follow the steps as below :)
• Select a cell where you want to place the hyperlink;
• Type a description of the workbook you want to link to;
• Right click on that cell and choose Hyperlink...;
• Click the File... button and browse to the file location;
• Select the file you want to link to and click OK;
• If you want to go to a specific sheet in the workbook, click on the Bookmark... button, select the sheet name and click OK.

• You can also click the Screen Tip... button to add a description to your hyperlink that will pop up when a user holds the mouse over the hyperlink.
• Click OK to close the Insert Hyperlink dialog box and save your workbook.
• Try out the hyperlink to see how it works.
in another workbook ( workbook2).
then in workbook follow the steps as below :)
• Select a cell where you want to place the hyperlink;
• Type a description of the workbook you want to link to;
• Right click on that cell and choose Hyperlink...;
• Click the File... button and browse to the file location;
• Select the file you want to link to and click OK;
• If you want to go to a specific sheet in the workbook, click on the Bookmark... button, select the sheet name and click OK.
• You can also click the Screen Tip... button to add a description to your hyperlink that will pop up when a user holds the mouse over the hyperlink.
• Click OK to close the Insert Hyperlink dialog box and save your workbook.
• Try out the hyperlink to see how it works.
Subscribe to:
Posts (Atom)