Solved

using date times in vb.net program

Posted on 2013-12-16
3
383 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 500 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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
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…

729 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