[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

vb.net script ssis

Posted on 2011-10-04
6
Medium Priority
?
291 Views
Last Modified: 2012-05-12
the following code outputs the date as 021011 i need to change it to YYYYMMDD.

Thanks.
Dim sqlResult As OleDbDataReader
        sqlResult = sqlCommand.ExecuteReader()
        While sqlResult.Read()
            myYear = CStr(Year(sqlResult.GetDateTime(0))).Substring(2, 2)
            If Month(sqlResult.GetDateTime(0)) < 10 Then
                myMonth = "0" + CStr(Month(sqlResult.GetDateTime(0)))
            Else
                myMonth = CStr(Month(sqlResult.GetDateTime(0)))
            End If
            If Day(sqlResult.GetDateTime(0)) < 10 Then
                myDay = "0" + CStr(Day(sqlResult.GetDateTime(0)))
            Else
                myDay = CStr(Day(sqlResult.GetDateTime(0)))
            End If

            myDate = myDay + myMonth + myYear

Open in new window

0
Comment
Question by:aneilg
  • 4
  • 2
6 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 1500 total points
ID: 36910592
Change following

myDate = myDay + myMonth + myYear

to

myDate = myYear + myMonth + myDay
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 1500 total points
ID: 36910594
Sorry it would be

myDate = "20" + myYear + myMonth + myDay
0
 

Author Comment

by:aneilg
ID: 36910763
my fault sorry. the date gets generated randomly everyday. At present the out is MMDDYY. I need the output to be YYYYMMDD.



Thanks.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 1500 total points
ID: 36910978
Where is it being generated? Did you try the above?

You can also do

DateTime.ToString("yyyyMMdd")
0
 

Author Closing Comment

by:aneilg
ID: 36923342
no tcomplete
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36926969
What else did you want?
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Integration Management Part 2
Suggested Courses
Course of the Month18 days, 21 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question