Question Locked

Create own Date Time in Visual Studio

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have created a Window Based Application using Visual Studio 2008. All the necessary Date entry in the whole Project are dependent on the system date.

I have done the following testings:

1. For example, the Date today is October 20,2009. If I made a transaction for today, it will have a transaction date of October 20,2009.

2. Now, I adjusted the System Date to October 19,2009. I made another transaction and the transaction date is equal to October 19,2009 which is supposed to be equal to October 20,2009 since the date today is October 20,2009.

My question is, is there any possible way for an application to have its own Date/Time to avoid being dependent on the System Date/Time?

Thanks in advance!

4 replies

by jck

System storable? No. The OS only holds one time and zone setting.

Programmably? Yes. You can store an offset of the current system date/time (zone/year/month/day/hour/min/sec) that you want for your system. Then, entries can be stored and adjusted according to your software-stored parameters and matched accordingly to real-world time.

by tony hopkinson

A bit of lateral thinking based on what I think you are saying you want.

Would be not to use the system clock at all, and simply have a place to store and maintain the date.

So at its; simplest you had a little UI function with transaction sdata in it and then you use that date in recording transactions.

Whne you want to enter them for a nother day, you change the transaction date, and on y va.

The usual way to attack this sort of thing is, is to open a 'day', do your stuff and them close the 'day', ie move to to the next one by default.

by jeffreyalejo

Thanks for the reply.

Yes. I don't want to use the system clock to avoid wrong date values if the system clock has invalid date.

This discussion is closed to new replies.