Thursday, May 23, 2013

Asp.Net How to Convert To Different Time Zones Using C#


Here I will Explain How To Get The Server Times Of Different Countries Using C#

Some Times We Come Across Different Date And Time Zones To Display, So By Using The Following Code You Can Get Different Countries Date And Time.
     
        DateTime now = DateTime.Now;            //Displays Our System Time
        c.Text = "Time is " + now.ToString() + " in your System";      

        string zoneId = "Central European Standard Time";
        TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(zoneId);
        DateTime result = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi);
        a.Text = "Time is " + result + " in Denmark";

        string zoneId1 = "India Standard Time";
        TimeZoneInfo tzi1 = TimeZoneInfo.FindSystemTimeZoneById(zoneId1);
        DateTime result1 = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi1);
        b.Text = "Time is " + result1 + " in India";

        string zoneId2 = "Central Standard Time";
        TimeZoneInfo tzi2 = TimeZoneInfo.FindSystemTimeZoneById(zoneId2);
        DateTime result2 = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi2);
        c.Text = "Time is " + result2 + " in Chicago";

Output:



Ramayana story narrated by a kid

Hi everyone,
this post is just for fun , i got a mail from my sister and its really funny so thought of sharing with all who visit this blog.


"May be Two years back….one of the proud school in Chennai where all felt admission is impossible. to get UKG admission for my friend’s daughter I too went there.  For that admission my friend had studied a lot than his daughter J
 The child could not understand why they have bought her there.  Principal of the school is like “kadalora kavithai Jenifer” (one of the filmy characters).  When I smiled at her, she turned & that moment my friend realized there is no benefit by my presence L

When we are all standing, the school principal started to converse with the child…yes in English only.  This is one of most memorable interview I have ever witnessed in my life..

“ “What’s your name?”

“Sarithra”

“Good. Tell me something you know”

“I know many things. Tell me what you want”

Alas, there is no better point for not getting the admission. .Sarithra’s mother was trying to make up the situation but Jenifer stopped..

Turning to child…Jenifer said.. “Tell any rhymes or story which you know”

Again…”Which one you want Rhymes or Story?”

Well done, second wicket too gone. Jenifer was little bit angry about the reply

“Ok. .tell me a story”

“You want to hear what I studied or what I wrote”

Taken to surprise, Jenifer asked “Oh you write stories”

“Why should I not write?”

Now even I was taken aback and whispered to my friend “our whole generation is not going to get admission in this school”

But Jenefier was impressed with the answer, she & including us, would have not heard such a story in our life

“Ok, tell me story which you have written”

Sarithra said “ Ravanan kidnapped Sita to Srilanka”

Opening scene failed to fail an impress Jenifer but still she encouraged the child to continue

“Rama asked Hanuman’s help to rescue Sita.  Hanuman too agreed to help Rama”
 “Then”
‘“Now, Hanuman called his friend Spider man”.no one expected this twist in the story
 “Why?”
 “Because there are lot of mountains between India and Srilanka..if we have Spiderman we can go easily with his rope”
 “But Hanuman can fly isn’t it”
 “Yes. But he is having Sanjeevi Mountain on one hand so he cannot fly very fast”
 (I remember Hanuman’s picture in ABT parcel serviceJ)
 Now Jenifer is quiet, after a while Sarithra asked “Should I continue or not”..
 “Ok ok then”
 “Hanuman and Spiderman flew to Srilanka and rescued Sita.  Sita said Thanks to both”
 “Why”
 “When you are helped you should say Thanks”
 “Ok Ok then”
 “Hanuman now called Hulk.”
 All were surprised…she realized our curiosity and said  “ Now Sita is there, so to take her safely back to Rama..he called Hanuman”
 What logic??? But Jenifer asked…
 “Hanuman can carry Sita right?”
 “Yes. But he has Sanjeevi Mountain in one hand and has to hold spider man on the other”
 Jenifier could not control her smile…”So when they all started to India they met my friend Akshay”
 “How come Akshay there now”
 “Because its my story and I can bring any one there”
 Now Jenifer didn’t get angry but waited for the next twist
 “Then all started to India and landed at Chennai Velechery bus stop”
 Now I asked “ Why they have landed In Velechery bus stop?”
 “Because they forgot the way..& Hulk got an idea and called Dora”
 I came to know about Doremon only there…
 “Doremon came and she took Sita to Velechery Venus Colony…that’s all”. Finished the story with a smile
Now Jenifer asked “Why venus Colony?”
 "Because sita there & am Sita”
 Jenifer impressed and embraced the child. She has been admitted in UKG & gifter her with a Doremon doll."
J