×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

SQL Date Time format problem

SQL Date Time format problem

SQL Date Time format problem

(OP)
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

RE: SQL Date Time format problem

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

RE: SQL Date Time format problem

(OP)
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?

RE: SQL Date Time format problem

(OP)
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

RE: SQL Date Time format problem

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close