Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

parse persian date string to datetime c#

PersianCalendar p = new PersianCalendar();
        string PersianDate1 = textBox1.Text;
        string[] parts = PersianDate1.Split('/', '-');
        DateTime dta1 = p.ToDateTime(Convert.ToInt32(parts[0]), Convert.ToInt32(parts[1]), Convert.ToInt32(parts[2]), 0, 0, 0, 0);
        string PersianDate2 = textBox2.Text;
        string[] parts2 = PersianDate2.Split('/', '-');
        DateTime dta2 = p.ToDateTime(Convert.ToInt32(parts2[0]), Convert.ToInt32(parts2[1]), Convert.ToInt32(parts2[2]), 0, 0, 0, 0);
        string s = (dta2 - dta1).ToString().Replace(".00:00:00", "");
        textBox3.Text = s; // Show the result into the textbox 
Comment

PREVIOUS NEXT
Code Example
Csharp :: asp.net render control to string 
Csharp :: how to run a console app in another app c# 
Csharp :: DotNet web Api Token based Authentication 
Csharp :: Visual Studio - Summary Tag Comments - Optional Params 
Csharp :: tee into file 
Csharp :: Get the Default gateway address c# 
Csharp :: dapper query list of parameters 
Csharp :: c# SQLite execute Command 
Csharp :: how can i only show just a part of alist in datagridview in c# 
Csharp :: visual studio auto generate and setters 
Csharp :: C# devexpress get foucused dataRow of child gridView 
Csharp :: string join inside foreach loop c# 
Csharp :: unity use of possibly unassigned field struct 
Csharp :: eager loading singleton c# dependency injection 
Csharp :: c# register write value 
Csharp :: aquarette 
Csharp :: c# how to start an application and detect if started 
Csharp :: panning script c# on phone 
Csharp :: Compiling C# Example 
Csharp :: constructor in protobuf-net 
Csharp :: getString 
Csharp :: how can datetimepicker accept hour as well 
Csharp :: rest api in c# 
Csharp :: using c# 
Csharp :: c# array backwards 
Csharp :: transform.rotate unity 2d 
Csharp :: how to resize a panel unity 
Csharp :: rb.addforce 3d c# 
Csharp :: random number between 1 and 100 c# 
Html :: ion-item remove bottom line 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =