Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formatting date

Status
Not open for further replies.

BG12424

Programmer
Jun 4, 2002
717
US
I need to be able to format a date given the year, month, day into the following format. How can I do this? Thanks

"1/1/1981 00:00:00"

regards,
Brian regards,
Brian
 
you can use the SerialDate() function to create a date object and then use FormatDateTime(yourDate,0) to returna formatted string.
Dim myDate, myDateString
myDate = dateSerial(myYear,myMonth,myDay)
myDateString = FormatDateTime(myDate,0)

or if you just need the string you could just concatenate them:
Dim mydatestring
mydate = myMonth & "/" & myDay & "/" & myYear & " 00:00:00"


-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top