?
Solved

using date times in vb.net program

Posted on 2013-12-16
3
Medium Priority
?
391 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

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

765 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