dbTalk Databases Forums  

better way to format dates

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss better way to format dates in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
chris
 
Posts: n/a

Default better way to format dates - 02-10-2004 , 06:13 PM






I need to create a folder with the date on it using VBS in
DTS. If I created one today, it would be named "2102004".
I need it to be "02102004". I can acheive this using my
example, but it seems as though there would be a better
way. Plus searches would be really tough.

Function Main()
dim month, day
if datepart("m",date) <= (9) then month = "0" &
datepart("m",date) _
else month = datepart("m",date) _
end if

if datepart("d",date) <= (9) then day = "0" &
datepart("d",date) _
else day = datepart("d",date) _
end if

msgbox month & day & datepart("yyyy",date)
Main = DTSTaskExecResult_Success
End Function

Any ideas?
TIA, Chris


Reply With Quote
  #2  
Old   
Felix Au
 
Posts: n/a

Default Re: better way to format dates - 02-10-2004 , 10:24 PM






@chris

Just a thought, In SQL you could use this to get the date format you
want:

select replace(convert(char(20),getdate(),103),'/','')

run this in the query analyzer.

you'll get i.e. : 27022004

Do you got any idea on how to place the record set of a temporary table
in ASP?



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.