Un poco de C#,JScript,VB, y CRM, Drupal, SQL , MSDCRM y MSDSL VBTools, developer, project lider, Social Media Activist, BlackBerry developer, telerik tools. (MCITP)
jueves, 22 de enero de 2015
How to get the base URL of the website VB.NET
Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath
martes, 6 de enero de 2015
UTF8 encode and decode VB.Net
Public Function XUTF8_Decode(ByVal pStr As String) As String
Dim Buffer As String
Dim i As Integer
Dim vChar() As Char = pStr.ToCharArray()
Dim vutf8data(vChar.Length) As Byte
'vutf8data = Encoding.UTF8.GetBytes(pStr)
For i = 0 To (vChar.Length - 1)
vutf8data(i) = System.Convert.ToByte(vChar(i))
Next
Buffer = Encoding.UTF8.GetString(vutf8data)
'Return .
XUTF8_Decode = Buffer
End Function
Public Function XUTF8_Encode(ByVal pStr As String) As String
Dim vutf8Encoding As New System.Text.UTF8Encoding
Dim vencodedString() As Byte
Dim vStringRes As String
vencodedString = vutf8Encoding.GetBytes(pStr)
vStringRes = vutf8Encoding.GetString(vencodedString)
'Return
XUTF8_Encode = vStringRes
End Function
Obtener los días del mes en SQL
Para obtener los días del mes en SQL lo podemos hacer de la siguiente manera, espero les sea muy útil.
DECLARE @mydate DATETIME
SELECT @mydate = GETDATE()
SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(@mydate)),@mydate),101) ,
'Último día del mes anterior'
UNION
SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(@mydate)-1),@mydate),101) AS Date_Value,
'Primer día del mes corriente' AS Date_Type
UNION
SELECT CONVERT(VARCHAR(25),@mydate,101) AS Date_Value, 'Hoy' AS Date_Type
UNION
SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,@mydate))),DATEADD(mm,1,@mydate)),101) ,
'Último día del mes corriente'
UNION
SELECT CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,@mydate))-1),DATEADD(mm,1,@mydate)),101) ,
'Primer día del mes siguiente'
GO
Suscribirse a:
Entradas (Atom)