Min Date?

Posted on 2014-10-31
Medium Priority
Last Modified: 2014-11-03
C# / .NET  /  AngularJS  /  JSON:

If I am passing a DateTime value as a parameter ... how do I get "MinDate" such that SQL Server (T-SQL) will consume it and JSON will translate it?

In other words, this is what I have been passing:

 ticketList = _esnService.ECIDHDTicketList(userProfile.VendorID,
                    DateTime.Parse("2009-03-13 22:16:00"),

Open in new window

Notice this param:

                    DateTime.Parse("2009-03-13 22:16:00"),

I want to do the same thing, but using something more generic, like "MinDate( )" or something or other.  I want to stop hard-coding the string that represents the datetime value.
Question by:Tom Knowlton
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 23

Assisted Solution

by:Ioannis Paraskevopoulos
Ioannis Paraskevopoulos earned 100 total points
ID: 40416945
Have you tried DateTime.Now

It will always fetch the current date and time at the time you request it. Both SQL and javascript should be able to handle it.
LVL 82

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 100 total points
ID: 40417182
date mindate = datetime.now.adddays(-365)   ' a year ago
LVL 40

Assisted Solution

by:Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger) earned 200 total points
ID: 40417187
If MinDate is always the same date, then simply write a method^

		public DateTime MinDate()
			return (DateTime.Parse("2009-03-13 22:16:00"));

Open in new window

 and call it:

LVL 11

Accepted Solution

Mihai Stancescu earned 1600 total points
ID: 40417926

If you really want min date for SQL Server you can use: SqlDateTime.MinValue (in System.Data.dll).
Notice that SQL MinDate is different than C# min date. Sql Min Date is 1st January 1753.

Hope this helps!


Author Closing Comment

by:Tom Knowlton
ID: 40419695

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month9 days, 22 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question