How to prevent from different date/time format on different pc

MBMSOFT

Registered User.
Local time
Today, 12:59
Joined
Jan 29, 2010
Messages
90
Any idea How to prevent from different date/time format on different pc

I've heard that I should create my own system time function in VBA which will not depend from the local pc system date/time setting

Regards
 
You can force a format like this for your date/time field in a form or report...

Code:
=Format([YourDateTimeField],"mm/dd/yyyy hh:nn:ss")
 
that's clear...
but the problem is if i want to use date function on that format
let's say that I've used this format :
dd.mm.yyyy
in some certain control

and the local date format settings is:
yyyy-mm-dd

then if I use
format(ctl,"ww") result is false

or if i've write in table date in one format all further action can be confused after somehow the local date settings had been changed or mdb would be used on other computer

any idea how to solve this problem
I need somehow to tell to VB that I use some certain date format instead the local date/time settings, so vb and access shouk ignore the local date format settings and accept my own date format settings used in mdb
 
You could try an input mask in that field to force the user to enter the date in a certain way... doesn't help with the already-existing ones though
 
that does not solve problem, i need to have my date format because a lot of command are based on one date format in code, so if i forse user to use other format it will make mass in all project .....

by the other side i can't force user to change his local date format because of my project to be able to work
that must be some way to ignore the local format settings with vba code
 
What if you store the date in the format you want in a text field in the table. Can you still work with the date data in a text format?
 
Re: How to prevent from different date/time format on different pc

You can force a format like this for your date/time field in a form or report...

=Format([YourDateTimeField],"mm/dd/yyyy hh:nn:ss")



but if format of [yourdatetimefield] is different from local date format

=Format([YourDateTimeField],"mm/dd/yyyy hh:nn:ss") will not give proper result

e.g.
=Format("15.04.2010","mm/dd/yyyy hh:nn:ss")
and if local dateformat is "yyyy-mm-dd"
the formula does not work




 
I'm not sure I understand your problem with the fomat of the date.

I use things like:
if format([MyDate], "yyyymmdd") > format(Now(), "yyyymmdd") then....

why should I care the PC date format ?
BTW using this format makes sure dates sorting is correct all time.
 
I need somehow to tell to VB that I use some certain date format instead the local date/time settings, so vb and access shouk ignore the local date format settings and accept my own date format settings used in mdb

VB uses the American format as a default, end of story.
We, in Europe, are flexible enough to cope with this when hardcoding dates into VBA, and SQL, so my suspicion is that you will have to learn to live with this fact.

Brian
 

Users who are viewing this thread

Back
Top Bottom