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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split text field into date and time field

Status
Not open for further replies.

2Plan

MIS
Mar 29, 2005
55
US
How can I split this text field into two fields (date & time)

2007-10-05 09:09:15.000
 
One way would be to use the Left() and Right() functions. Another would be to use the Mid() function.

"Before you criticize someone, you should walk a mile in their shoes.
That way, when you criticize them, you're a mile away and you have their shoes."
 
Don't forget Split() and Regular Expressions. :)

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
If you are starting with an actual date value and not a string then you can just use the format command.

?format(now(),"YYYY-MM-DD")
2008-02-22

?format(now(),"HH:MM:SS.0000")
12:39:58.0000

If it is a string you can use string manipulation as genomon states.
 
How are ya 2Plan . . .

In parallel with [blue]genomon[/blue]:
Code:
[blue]   Me!txtDate = Left(Me![purple][b][i]TextboxName[/i][/b][/purple], 10)
   Me!txtTime = Right(Me![purple][b][i]TextboxName[/i][/b][/purple], 12)[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
try the DateValue and TimeValue funtion.

Code:
Me!txtDate = DateValue(Me!TextboxName)
Me!txtTime = TimeValue(Me!TextboxName)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top