Free programming examples and instructions

Get Indian time in Asp.net - C#

Demo and Code for how to get Indian date and time in Asp.net - C#

by Athil

Posted on 30 Jul 2017 Category: Asp.net Views: 879

Edited on 25 Jul 2018


Hi, Here I am going to show how to get Indian Date and time in asp.net.

 TextBox1.Text = DateTime.UtcNow.AddHours(5).AddMinutes(30).ToString();

In the above code, I added 5 hours and 30 minutes along with the UTCDatetime.

Full Demo Code For Indian Date and time

On Client Side

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Demo for get Indian date and time in  ASP.net - C#</title>
    <form id="form1" runat="server">
   <h1>Demo for get Indian date and time in  ASP.net - C#</h1>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Get Indian TIME" />

On Server Side

protected void Button1_Click(object sender, EventArgs e)
   TextBox1.Text = DateTime.UtcNow.AddHours(5).AddMinutes(30).ToString();

Leave a Comment: