Computer Science Canada

How to recognize the date?

Author:  Ashi_Mashi2 [ Mon Mar 28, 2005 3:44 pm ]
Post subject:  How to recognize the date?

hi AGAIN!!
I'm designing a project, so i need lots of help..thanks for your support!

Ok...i need to get the date from the computer. Easy:

FormatDateTime (Now,vbShortDate)

but, i realized that it is different in every computer, for example, one displays mm/dd/yyyy another dd/mm/yyyy or dd/mm/yy, etc. Now, how can i distinguish which is which and use them (I specifically need to distinguish between month and date)...

Thanks AGAIN!

Author:  Tony [ Mon Mar 28, 2005 3:57 pm ]
Post subject: 

that's just the settings to display the date in different formats. Values VB gets from the system should be the same regardless.

Author:  Ashi_Mashi2 [ Mon Mar 28, 2005 4:08 pm ]
Post subject: 

ok...so, is there anyway to change the setting of the computer using VB?

Author:  Tony [ Mon Mar 28, 2005 4:25 pm ]
Post subject: 

why would you change system's settings if the user likes it to be the other way? Confused

Author:  Ashi_Mashi2 [ Mon Mar 28, 2005 5:20 pm ]
Post subject: 

lol...ok...maybe you didnt get my point...i want to have the exact date for my program (because it is a calendar)...so, i need to exactly know today's date, month, and year (not the user, i dont care about the user!) ...so, that i can use these information to compile the rest of the program (which would convert the date to another calendar).....

so, if my month/date is mixed up, all my work is garbage Sad

Author:  Tony [ Mon Mar 28, 2005 9:55 pm ]
Post subject: 

do you actually have two computers that give you different dates from the same Time function? Confused

Anyways, if you're really conserned, I would imagine there's something like

FormatDateTime (Now,vbMonth)

or something similar

Author:  Brightguy [ Tue Mar 29, 2005 2:33 pm ]
Post subject:  Re: How to recognize the date?

You can choose exactly how you want the date output by User-Defined Date/Time Formats.
code:
Print Format(Now, "dddd, mmm d yyyy hh:mm:ss AMPM")     'Tuesday, Mar 29 2005 02:29:38 PM

However, if you're just interested in getting the month, day, hour, etc... then just use the Month, Day or Hour functions.
code:
Print "It is now " & Hour(Now) & " o'clock."

Author:  Ashi_Mashi2 [ Tue Mar 29, 2005 4:25 pm ]
Post subject: 

yeah...thanks a lot it works;).... just like Day(now) instead of formatdatetime (now)....

anyway...thx


: