Reply to topic  [ 4 posts ] 
Date format dd/mm/yyyy 
Author Message

Joined: Sat Dec 10, 2022 9:47 pm
Posts: 2
Reply with quote
Post Date format dd/mm/yyyy
Hello,

I'm having trouble getting dates to consistently come out in "dd/mm/yyyy" format. When the day <= 12, it utilises this as the month.

I've attached 3 files:
- The raw data from SQL Server (the column datatype is "datetime").
- The code I'm using to write to and format the cell using EasyXLS.
- The output in Excel. The orange column is what EasyXLS is outputting; the green column is what I'm expecting based on my ".setFormat.."

Thanks in advance!


Attachments:
Output.png
Output.png [ 6.38 KiB | Viewed 55923 times ]
Code.png
Code.png [ 5.54 KiB | Viewed 55923 times ]
Table Data.png
Table Data.png [ 3.93 KiB | Viewed 55923 times ]
Sat Dec 10, 2022 9:51 pm
Profile

Joined: Wed Nov 07, 2007 4:42 am
Posts: 67
Reply with quote
Post Re: Date format dd/mm/yyyy
Hi,

You need to extract data from sql in "mm/dd/yyyy" format and then set the data type as DataType.DATE for best performances. Other similar date formats are recognized as M/d/y or M-d-y.

A date value is a calendar date that can also include the time. We recommend entering the date values in "mm/dd/yyyy" format (i.e. 12/23/2005) for optimization purposes. Later, to apply a different format, the cell can be formatted using the desired date format, as you did.

You might want to check this chapter in our online User Guide
https://www.easyxls.com/manual/basics/i ... ate-values


Wed Dec 14, 2022 5:58 am
Profile WWW

Joined: Sat Dec 10, 2022 9:47 pm
Posts: 2
Reply with quote
Post Re: Date format dd/mm/yyyy
Thanks oana! Using your suggestion I was able to fix by reorganising the date format in the Classic ASP to "mm/dd/yyyy" before writing to the spreadsheet, and this fixed it <- src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" />


Attachments:
Updated Code.png
Updated Code.png [ 9.52 KiB | Viewed 55900 times ]
Wed Dec 14, 2022 4:59 pm
Profile

Joined: Wed Nov 07, 2007 4:42 am
Posts: 67
Reply with quote
Post Re: Date format dd/mm/yyyy
That is good news. You are very welcome, James!


Thu Dec 15, 2022 4:33 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.