Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How to recognize the date?
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Ashi_Mashi2




PostPosted: 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!
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Mar 28, 2005 3:57 pm   Post subject: (No subject)

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




PostPosted: Mon Mar 28, 2005 4:08 pm   Post subject: (No subject)

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




PostPosted: Mon Mar 28, 2005 4:25 pm   Post subject: (No subject)

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




PostPosted: Mon Mar 28, 2005 5:20 pm   Post subject: (No 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
Tony




PostPosted: Mon Mar 28, 2005 9:55 pm   Post subject: (No 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
Brightguy




PostPosted: 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."
Ashi_Mashi2




PostPosted: Tue Mar 29, 2005 4:25 pm   Post subject: (No subject)

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

anyway...thx
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: