Date Conversion From Mm/dd/yyy To Dd/mm/yyyy Follow

0
Avatar
Legacy Poster

Hi All,
I am using Bar Tender 9.4 v, my DB consists of date format in "MM/DD/YYYY" and in some cases i need to convert this Date format which i pick from DB to the type "DD/MM/YYYY".

[b]Note[/b]: It is not the simple System Date, here i am getting the date from Data Base which is in format "MM/DD/YYYY".

5 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

1. For your database connected text object, be sure to specify some sort of valid date for the "Sample Data" in order to avoid and VB Script errors at design time.

2. Click the "More Options" button, select the "VB Scripting" tab and then for the "OnProcessData" VB Script, enter something like the below expression to reformat the date.

[code]value = Day(value) & "/" & Month(value) & "/" & Year(value)[/code]
0
Avatar
Legacy Poster
Comment actions Permalink

[quote name='Ian C - Seagull Support' timestamp='1322060408' post='1134']
1. For your database connected text object, be sure to specify some sort of valid date for the "Sample Data" in order to avoid and VB Script errors at design time.

2. Click the "More Options" button, select the "VB Scripting" tab and then for the "OnProcessData" VB Script, enter something like the below expression to reformat the date.

[code]value = Day(value) & "/" & Month(value) & "/" & Year(value)[/code]
[/quote]

Thanks a lot its working if i am giving value hard cored but if i place a data base field instead of value its violating
0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Like I said, replace the sample data for your database connected sub-string with a valid date. The sub-string is still connected to the database field, but for display purposes it shows a valid date of some kind.
0
Avatar
Legacy Poster
Comment actions Permalink

[quote name='Ian C - Seagull Support' timestamp='1322064465' post='1137']
Like I said, replace the sample data for your database connected sub-string with a valid date. The sub-string is still connected to the database field, but for display purposes it shows a valid date of some kind.
[/quote]
I have tried as you said even though i got a runtime error like "bartender: warning message #5901" and i am not able to view preview
This is what i placed in vb script:
value = Day(Format.NamedSubStrings("date").Value) & "/" & Month(Format.NamedSubStrings("date").Value) & "/" & Year(Format.NamedSubStrings("date").Value)
0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Ah okay, I think I know the problem. Try this instead:

value = Mid(Format.NamedSubStrings("date").Value),4,2) & "/" & Left(Format.NamedSubStrings("date").Value),2) & "/" & Right(Format.NamedSubStrings("date").Value),4)

Please sign in to leave a comment.