PC Review


Reply
Thread Tools Rate Thread

Date format changes from 'yyyy-mm-dd hh:mm:ss' to 'mm/dd/yyyy'

 
 
=?Utf-8?B?c3Npbmdo?=
Guest
Posts: n/a
 
      4th May 2007
I am working on a QTP script which executes sybase queries and exports the
results to an excel. The recordset sometimes has date values, numbers with
leading zeroes etc.

To ensure that the format of all the values is retained after results are
exported to excel , I used the following code:-

ExcelObj.selection.NumberFormat = "@" to change the format of the excel to
'text'.

Inspite of using the above code the date format is getting changed :-

Sybase query originally returns date in format : 'yyyy-mm-dd hh:mm: ss' .
When this value is pasted on excel it gets changed to 'mm/dd/yyyy'.

Need help to fix this! Any suggestions?

TIA
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      4th May 2007
Assume the date comes into column 3, then:
columns(3).Numberformat = "yyyy-mm-dd hh:mm:ss"

If it doesn't work doing it before, then do it after the data is imported
and interpreted.


--
Regards,
Tom Ogilvy


"ssingh" wrote:

> I am working on a QTP script which executes sybase queries and exports the
> results to an excel. The recordset sometimes has date values, numbers with
> leading zeroes etc.
>
> To ensure that the format of all the values is retained after results are
> exported to excel , I used the following code:-
>
> ExcelObj.selection.NumberFormat = "@" to change the format of the excel to
> 'text'.
>
> Inspite of using the above code the date format is getting changed :-
>
> Sybase query originally returns date in format : 'yyyy-mm-dd hh:mm: ss' .
> When this value is pasted on excel it gets changed to 'mm/dd/yyyy'.
>
> Need help to fix this! Any suggestions?
>
> TIA

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I change date from mm/dd/yyyy to dd:mm:yyyy format in Excel =?Utf-8?B?SmFjayBXaWxzb24=?= Microsoft Excel New Users 4 18th Jul 2006 01:57 PM
opening excel file -> date format problem: DD/MM/YYYY vs MM/DD/YYYY yung Microsoft Excel Programming 2 18th Mar 2005 12:50 PM
Date format : field set to dd/mm/yyyy, but query wants mm/dd/yyyy aa Microsoft Access Database Table Design 2 29th Dec 2003 10:53 AM
Date format : field set to dd/mm/yyyy, but query wants mm/dd/yyyy aa Microsoft Access Queries 2 29th Dec 2003 10:53 AM
Date format : field set to dd/mm/yyyy, but query wants mm/dd/yyyy aa Microsoft Access 2 29th Dec 2003 10:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:20 AM.