Click here to Skip to main content
12,625,447 members (36,962 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi frens


I need to convert the following code(vb) to c# ....how can i do it

DateAndTime.WeekdayName(DateAndTime.Weekday(iDate,Constants.vbsunday),false,constants.vbsunday + "" + DateAndTime.MonthName(DateAndTime,Month(idate))+ "" ;


Thanks in Advance
Darshan
Posted 21-Dec-12 3:04am
Updated 21-Dec-12 3:30am
v2
Comments
Krunal Rohit 21-Dec-12 8:07am
   
What you are trying to achieve ??
Zoltán Zörgő 21-Dec-12 8:31am
   
It looks to me as simple formatting... What is the input, and what output you want?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

With the exception of one missing bracket it is already C# - as shown by the terminating semicolon.

You have a missing close bracket, which I assume should be after the vbsunday.

To translate from VB to C# try this: http://www.developerfusion.com/tools/convert/vb-to-csharp/[^]
  Permalink  
Comments
darshan559 21-Dec-12 9:01am
   
Thanks for the reply .....Ya i tried to convert to c# using a tool ....Actually It ws in VB ....DateandTIme.WeekDayName() i guess is a inbuilt VB Function Which is not available in c#...So i need C# equivalent of DateandTIme.WeekDayName(); function
OriginalGriff 21-Dec-12 9:06am
   
Try:
DateTime now = DateTime.Now;
Console.WriteLine(now.DayOfWeek.ToString());
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Hi,

Some online convert tools:
http://www.dotnetspider.com/convert/Vb-To-Csharp.aspx[^]
http://codeconverter.sharpdevelop.net/SnippetConverter.aspx[^]
And to get the DateAndTime class, you need to add a reference to Microsoft.VisualBasic.dll.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 21 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100