[AccessD] Date Format Again

Gustav Brock gustav at cactus.dk
Fri May 21 08:19:10 CDT 2004


Hi Rocky

I think you are facing a dead end.
Why not use

  Date

to retrieve the system date?

/gustav


> OK. I solved it but it's a kludge and I don't like it.  Turns out that the
> problem was not mm/dd/yy vs. dd/mm/yy. It was either of those vs.
> yyyy-mm-dd, which is the same in either UK or American English setting.  In
> Taiwan they use the American date format but this particular machine's short
> date format was set to yyyy-mm-dd.

> So.

> I changed

> 'Flip Dates if regional setting is dd/mm/yy

> If DateValue("1/6/04") = DateValue("1 Jun 04") Then
>     gdatExpirationDate = Mid(gdatExpirationDate, 4, 2) & "/" &
> Left(gdatExpirationDate, 2) _
>         & "/" & Right(gdatExpirationDate, 2)

> to

> 'Flip Dates if regional setting is dd/mm/yy; check that date format is not
> yyyymmdd

> If DateValue("1/6/04") = DateValue("1 Jun 04") And Val(DatePart("yyyy",
> Date)) <> Val(Left(Date, 4)) Then
>     gdatExpirationDate = Mid(gdatExpirationDate, 4, 2) & "/" &
> Left(gdatExpirationDate, 2) _
>         & "/" & Right(gdatExpirationDate, 2)

> and it works.  But it doesn't seem clean.

> Getting the short date format via API, I suppose, would be better.  Same
> result but better because I anticipate that there will be sometime a fourth
> date format.

> Thanks to all for help,

> Rocky Smolin
> Beach Access Software
> http://www.e-z-mrp.com


> ----- Original Message ----- 
> From: "Gustav Brock" <gustav at cactus.dk>
> To: "Access Developers discussion and problem solving"
> <accessd at databaseadvisors.com>
> Sent: Wednesday, May 19, 2004 8:43 AM
> Subject: Re: [AccessD] Date Format Again


>> Hi Rocky
>>
>> If you are encoding the date as a date string, you need to decode that
>> and parse it to build the date value; that may involve a little
>> puzzling with Mid() to get strYear, strMonth and strDay which you can
>> convert to Longs and feed to DateSerial().
>>
>> /gustav
>>
>>
>> > If they use the US date format, then what do you mean by their having
>> > their machines set to yyy-mm-dd?   Cdate(Date) will return a  date in
>> > the system format.
>>
>> > Charlotte Foust
>>
>> > -----Original Message-----
>> > From: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com]
>> > Sent: Wednesday, May 19, 2004 7:06 AM
>> > To: AccessD at databaseadvisors.com
>> > Subject: [AccessD] Date Format Again
>>
>>
>> > Dear List:
>>
>> > I thought I had the date format problem solved but in Taiwan they use
>> > the US format but they've got their machines set to yyy-mm-dd.
>>
>> > The problem is that I have a license expiration date encrypted in a key
>> > and so the routine that decodes the key yields (among other things) the
>> > expiration date which I compare to the system date.
>>
>> > So I guess I'm going to have to use an API to get the regional setting
>> > for short date format?  I've been mucking around in the Knowledgebase
>> > but can't seem to find what I want.
>>
>> > Does anyone know the format for retrieving this item?
>>
>> > I guess I will have to use a Select Case on the short date format to do
>> > the decryption to yield a short date in the local format.  And just add
>> > cases as I find more short date formats.




More information about the AccessD mailing list