To Add Minutes/Seconds
<datetime variable>.AddMinute(double value);
<datetime variable>.Addseconds(double value);
To Substract Minutes/Seconds
<datetime variable>.AddMinute(-(double value));
<datetime variable>.Addseconds(-(double value));
string strUserAgent = Request.UserAgent.ToString().ToLower();
if (strUserAgent != null)
{
if (Request.Browser.IsMobileDevice == true || strUserAgent.Contains("iphone") ||
strUserAgent.Contains("blackberry") || strUserAgent.Contains("mobile") ||
strUserAgent.Contains("windows ce") || strUserAgent.Contains("opera mini") ||
strUserAgent.Contains("palm"))
{
//Request from Mobile Device
}
else{
//Request from Computer
}
}
if (Request.UserAgent.IndexOf("Windows NT 5.1") > 0)
{ //Windows XP
}
else if (Request.UserAgent.IndexOf("Windows NT 5.0") > 0)
{ //Windows 2000
}
else
{ //Other Operation System
}
<!-- p class="title">Browser Capabilities :</p -->
<table width="90%" border="0" align="center"
cellpadding="2" cellspacing="2">
<tr class="header">
<td width="30%">Property</td>
<td>Value</td>
</tr>
<tr>
<td>ActiveXControls </td>
<td> <%= Request.Browser.ActiveXControls %></td>
</tr>
<tr>
<td>AOL </td>
<td> <%= Request.Browser.AOL %></td>
</tr>
<tr>
<td>BackgroundSounds </td>
<td> <%= Request.Browser.BackgroundSounds %></td>
</tr>
<tr>
<td>Beta </td>
<td> <%= Request.Browser.Beta %></td>
</tr>
<tr>
<td>Browser </td>
<td> <%= Request.Browser.Browser %></td>
</tr>
<tr>
<td>CDF </td>
<td> <%= Request.Browser.CDF %></td>
</tr>
<tr>
<td>ClrVersion </td>
<td> <%= Request.Browser.ClrVersion %></td>
</tr>
<tr>
<td>Cookies </td>
<td> <%= Request.Browser.Cookies %></td>
</tr>
<tr>
<td>Crawler </td>
<td> <%= Request.Browser.Crawler %></td>
</tr>
<tr>
<td>EcmaScriptVersion </td>
<td> <%= Request.Browser.EcmaScriptVersion %></td>
</tr>
<tr>
<td>Frames </td>
<td> <%= Request.Browser.Frames %></td>
</tr>
<tr>
<td>JavaApplets </td>
<td> <%= Request.Browser.JavaApplets %></td>
</tr>
<tr>
<td>JavaScript </td>
<td> <%= Request.Browser.JavaScript %></td>
</tr>
<tr>
<td>MajorVersion </td>
<td> <%= Request.Browser.MajorVersion %></td>
</tr>
<tr>
<td>MinorVersion </td>
<td> <%= Request.Browser.MinorVersion %></td>
</tr>
<tr>
<td>MSDomVersion </td>
<td> <%= Request.Browser.MSDomVersion %></td>
</tr>
<tr>
<td>Platform </td>
<td> <%= Request.Browser.Platform %></td>
</tr>
<tr>
<td>Tables </td>
<td> <%= Request.Browser.Tables %></td>
</tr>
<tr>
<td>Type </td>
<td> <%= Request.Browser.Type %></td>
</tr>
<tr>
<td>VBScript </td>
<td> <%= Request.Browser.VBScript %></td>
</tr>
<tr>
<td>Version </td>
<td> <%= Request.Browser.Version %></td>
</tr>
<tr>
<td>W3CDomVersion </td>
<td> <%= Request.Browser.W3CDomVersion %></td>
</tr>
<tr>
<td>Win16 </td>
<td> <%= Request.Browser.Win16 %></td>
</tr>
<tr>
<td>Win32 </td>
<td> <%= Request.Browser.Win32 %></td>
</tr>
</table>
CONVERT(data_type(length),data_to_be_converted,style) |
Style ID | Style Format |
---|---|
100 or 0 | mon dd yyyy hh:miAM (or PM) |
101 | mm/dd/yy |
102 | yy.mm.dd |
103 | dd/mm/yy |
104 | dd.mm.yy |
105 | dd-mm-yy |
106 | dd mon yy |
107 | Mon dd, yy |
108 | hh:mm:ss |
109 or 9 | mon dd yyyy hh:mi:ss:mmmAM (or PM) |
110 | mm-dd-yy |
111 | yy/mm/dd |
112 | yymmdd |
113 or 13 | dd mon yyyy hh:mm:ss:mmm(24h) |
114 | hh:mi:ss:mmm(24h) |
120 or 20 | yyyy-mm-dd hh:mi:ss(24h) |
121 or 21 | yyyy-mm-dd hh:mi:ss.mmm(24h) |
126 | yyyy-mm-ddThh:mm:ss.mmm(no spaces) |
130 | dd mon yyyy hh:mi:ss:mmmAM |
131 | dd/mm/yy hh:mi:ss:mmmAM |
CONVERT(VARCHAR(19),GETDATE()) CONVERT(VARCHAR(10),GETDATE(),110) CONVERT(VARCHAR(11),GETDATE(),106) CONVERT(VARCHAR(24),GETDATE(),113) |
#if | Code snippet for #if |
#region | Code snippet for #region |
attribute | Code snippet for attribute using recommended pattern |
checked | Code snippet for checked block |
class | Code snippet for class |
ctor | Code snippet for constructor |
~ | Code snippet for destructor |
cw | Code snippet for Console.WriteLine |
do | Code snippet for do…while loop |
else | Code snippet for else statement |
enum | Code snippet for enum |
equals | Code snippet for implementing Equals() according to guidelines |
exception | Code snippet for exception |
for | Code snippet for ‘for’ loop |
foreach | Code snippet for foreach statement |
forr | Code snippet for reverse ‘for’ loop |
if | Code snippet for if statement |
indexer | Code snippet for indexer |
interface | Code snippet for interface |
invoke | Code snippet for safely invoking an event |
iterator | Code snippet for a simple iterator |
iterindex | Code snippet for ‘named’ iterator/indexer pair using a nested class |
lock | Code snippet for lock statement |
mbox | Code snippet for MessageBox.Show |
namespace | Code snippet for namespace |
prop | Code snippet for an automatically implemented property |
propg | Code snippet for an automatically implemented property with a ‘get’ access or and a private ‘set’ accessor |
sim | Code snippet for int Main() |
struct | Code snippet for struct |
svm | Code snippet for ‘void Main’ method |
switch | Code snippet for switch statement |
try | Code snippet for try catch |
tryf | Code snippet for try finally |
unchecked | Code snippet for unchecked block |
unsafe | Code snippet for unsafe statement |
using | Code snippet for using statement |
while | Code snippet for while loop |
-- Use single quotes around literal string
SELECT CategoryID, CategoryName, 'Northwind Category' AS Note
FROM categories;
-- Use double quotes around literal string
SELECT CategoryID, CategoryName, "Northwind Category" AS Note
FROM categories;
-- Concatenate strings and columns
SELECT CONCAT('Quantity Per Unit for ', ProductName, ' is ', QuantityPerUnit)
AS "Product Details"
FROM products;
-- Escape single quote character
SELECT CategoryName, 'Northwind\'s category name' AS Note
FROM categories
-- Use two single quote characters to mimic the effect of
-- escaping one single quote character.
SELECT CategoryName, 'Northwind''s category name' AS Note
FROM categories;
-- Escape double quote character
SELECT CategoryName, "Northwind \"category\" name" AS Note
FROM categories;
-- Use two double quote characters to mimic the effect of
-- escaping one double quote.
SELECT CategoryName, "Northwind ""category"" name" AS Note
FROM categories;
-- A single quote inside a literal string quoted with two double
-- quotes needs no special treatment and need not to be doubled or escaped.
SELECT CategoryName, "Northwind category's name" AS Note
FROM categories;
-- double quote characters inside a literal string quoted
-- with two single quote characters needs no special treatment
-- and need not to be doubled or escaped.
SELECT CategoryName, 'Northwind "category" name' AS Note
FROM categories;
-- Add a backslash in the literal string
SELECT CategoryName, 'Northwind \\ category name' AS Note
FROM categories;
-- Add line break in the result set. Line break is achieved by using
-- newline character escape sequence \n
SELECT CategoryName, 'Northwind \ncategory \nname' AS Note
FROM categories;
<asp:TextBox ID="TextBox1" runat="server"/>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="errormessage"></asp:RequiredFieldValidator>
If Not Request.IsSecureConnection Then
Response.Redirect("https://www.domain.com/yourpage.aspx ")
End If
Function Dollars(ByVal amount As Decimal, _ Optional ByVal EmptyStringIfZero As Boolean = True) As String Dim result As String = String.Empty Select Case amount Case 0 result = If(EmptyStringIfZero, String.Empty, "Zero ") Case 1 To 19 result = Choose(amount, "One ", "Two ", "Three ", "Four ", _ "Five ", "Six ", "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ", _ "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", _ "Seventeen ", "Eighteen ", "Nineteen ") Case 20 To 99 result = Choose(amount \ 10 - 1, "Twenty ", "Thirty ", _ "Fourty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", _ "Ninety ") & Dollars(amount Mod 10) Case 100 To 999 result = Dollars(amount \ 100) & "Hundred" & IIf _ (amount >= 200, "s ", " ") & Dollars(amount Mod 100) Case 1000 To 999999 result = Dollars(amount \ 1000) & "Thousand" & IIf _ (amount >= 2000, "s ", " ") & Dollars(amount Mod 1000) Case 1000000 To 999999999 result = Dollars(amount \ 1000000) & "Million" & IIf _ (amount >= 2000000, "s ", " ") & Dollars(amount Mod 1000000) Case Is >= 1000000000 result = Dollars(amount \ 1000000000) & "Billion" & _ IIf(amount >= 2000000000, "s", " ") & Dollars(amount Mod 1000000000) End Select Return result End Function Public Function Cents(ByVal amount As Decimal) As String Dim result As String = amount.ToString If result.Contains("."c) Then result = result.Substring(result.IndexOf("."c) + 1) Else result = "00" End If Return " and " & result & "/100" End Function
Dim amount As Decimal = Decimal.Parse("123.45") Response.Write(Dollars(amount) & Cents(amount))