Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

using date times in vb.net program

Posted on 2013-12-16
3
Medium Priority
?
396 Views
Last Modified: 2014-01-06
I have a program that compares the date of an invoice to the date using
mydate as date = now

The program I realize is that if the user changes their system date, then that is the date that will be pulled from this line of code.

I know I can use  a getdate() statement and get it from my sql server, but I was wondering what the correct way is to handle this problem.

thanks
0
Comment
Question by:mgmhicks
[X]
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
3 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 39722409
Is this an ASP.net web forms application/site ? If so getting the current date on the code-behind pages or a business layer class is the recommended method as this will use the date/time from the IIS server rather than the client.
If it is a windows forms application then getting the date on the SQL Server is probably the best and most reliable method as client dates can be suspect, and also problematic if the application is used by clients in differing time zones.
0
 
LVL 16

Expert Comment

by:Kamal Khaleefa
ID: 39723593
try to set a unique format for you date
or in your code behind format the date like this

   dim ExpiryDate as date = DateTime.ParseExact(MyTextBoxID.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture)
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 39724543
>The program I realize is that if the user changes their system date, then that is the date that will be pulled from this line of code.


One option is to use a date server on the net to get the date

http://www.codeproject.com/Tips/356303/How-to-get-server-side-date-time-without-your-own
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

610 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