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

SQL Date Time format problem 1

Status
Not open for further replies.

bakershawnm

Programmer
Apr 18, 2007
84
US
I have been using Visio 2003 off and on for about 7 months now. I have asked a couple of questions that have gone unanswered. I'm hoping to get a better response from this one.

I am trying to extract information from a SQL data base. I link my master to the table and do all the things right. When I link to the table the default data type for most of the fields is string. Not problem there, I can change that in the custom properties. However the Date/Time fromat that I am getting from SQL are in seperate fields and look something like this:

2007-10-10 00:00:00.000 for a date
1900-01-01 14:15:23.000 for a time

Since this is not a standard recognized date/time format for Visio, I cannot get anything unless I leave the data type as a string.

Anybody have any easy/quick code that I can use to parse this string into a real date and time? Or maybe another solution to my dilema?

Thanks
 
It looks like SQL has a single date format, but you have extracted just the date portion in the first and the time in the second. You could "trim" both fields and concatenate them into a new date field. Did you check if SQL has a combined Date/Time format?

John... Visio MVP - Visio.MVPs.org
 
Currently the database I am accessing does not have a combined date/time so I am stuck with trying to trim the unnecessary portions off.

What do I need to do to trim this off in Visio?
 
After I posted my last, I went digging into Visio Help. Found what I needed.

=DATEVALUE(LEFT(Prop.SCHEDULESTARTDATE_I,10))+TIMEVALUE(MID(Prop.SCHEDULESTARTTIME_I,12,8))

TRIM wasn't sufficient but it put me onto the right track

Thanks much
 
Glad you got it working. I put trim in quotes hoping it would not be confused with TRIM(). I meant you would have to cut off pieces from each one and stick it back togehter. A combination of LEFT() and RIGHT() should have worked as for this.


John... Visio MVP - Visio.MVPs.org
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top