Change the culture
for Indian date date format(dd/MM/yyyy)
for Indian date date format(dd/MM/yyyy)
<%@ Page Language="C#" MasterPageFile="~/MasterUser.master" Culture="en-CA" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="default" Title="" %>
C#
---------
public string IndianDateConverter(string Dat)
{
string[] StrArr;
string str;
StrArr = Dat.Split('/');
str = Convert.ToString(StrArr[0]);
StrArr[0] = Convert.ToString(StrArr[1]);
StrArr[1] = str;
Dat = "";
Dat = StrArr[0] + "/";
Dat += StrArr[1] + "/";
Dat += StrArr[2];
return Dat;
}
VB.Net
-----------
Public Function fn_convertdate(ByVal dates As String) As String
Try
Dim strr(), str As String
str = dates
strr = dates.Split("/")
str = strr(0)
strr(0) = strr(1)
strr(1) = str
dates = ""
dates = strr(0) & "/"
dates += strr(1) & "/"
dates += strr(2)
Return dates
Catch ex As Exception
End Try
End Function
No comments:
Post a Comment