473,883 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert excel date to asp date

20 New Member
Please help me to convert excel date to asp date.

Here is my code


objConnEx.open "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=D:\Netro ot\WebApp\testp rograms\Shuttle _Service\Attach ment\BusRequest .xls;Extended Properties=Exce l 8.0;HDR=Yes;IME X=1;"
set objRS = server.createOb ject("ADODB.rec ordset")
SQL = "SELECT * from [BusRequest$]"
objRS.Open SQL,objConnEx, 1

Do until objRS.eof

Response.write( objRS.fields(0) .Value)
// The value of this in excel is 06/29/2007


objRS.Movenext
Loop

The output of this script is
39336
How Can I convert 39336 to 6/29/2007?

Thanks


THanks
Jul 3 '07 #1
3 2846
justintaitt
11 New Member
Hi,
You could probably try the FromOADate() function. The only thing was when I tried it with the value you supplied I was off by 74 days so I subtracted that. Not sure if it would be affected by leap years though.


Expand|Select|Wrap|Line Numbers
  1.  
  2.         Dim myDate As DateTime
  3.  
  4. myDate = DateTime.FromOADate(39336 - 74)
  5.  
  6. Response.Write(myDate.ToString)
The 39336 would be replaced with a variable. Hope this helps.
Jul 3 '07 #2
jhardman
3,406 Recognized Expert Specialist
Hi,
You could probably try the FromOADate() function. The only thing was when I tried it with the value you supplied I was off by 74 days so I subtracted that. Not sure if it would be affected by leap years though.
I tried it in excel and I also got 9/11/07

Jared
Jul 3 '07 #3
justintaitt
11 New Member
I tried it in excel and I also got 9/11/07

Jared
I don't know then, I created a new website and tried that and it worked.

Forgive me for asking, but did you subtract the 74?
Jul 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
59429
by: meh | last post by:
I have imported data from excel file. When data came to SQL table, the type of AMOUNT column was varchar. I tried to convert and cast amount type of amount column to number type but it does not allow me to convert. What is the best way of importing data into SQL and type stays the same as it was in excel file ? Or anyone has any better solution, please let me. Thanks.
3
29045
by: jerry.ranch | last post by:
I have a need to convert simple dates (i.e. 02/14/2005) to a number, do some math, and convert back to a date. (in a simple query). The math involves adding or substracting days, and days of the week . I've used the weekday() function to convert dates to numberic days of the week (1-7) I've used cdbl (date) to convert a date to a serial number, but then I do math with the number and I can't seem to convert this back to a date.
2
5097
by: Franck | last post by:
Hi, 'm gettin mad about date conversion. Here is the point. Got and add-in for Excel which call functions from a web service (on a remote server) The remote server has regional settings set to "en-UK" and date to
4
15432
by: Daniel Kaseman | last post by:
How do I convert a date into a serial number? (I'm trying to enter a FROM date and a TO date, then make my PROGRESS BAR show how close I am to the TO date.) get it? I know that MS Excel converts Dates into serial numbers, but I can't figure out how to do it with VB.Net. Please help, thanks.
1
2666
by: simchajoy2000 | last post by:
Hi, I am reading some dates from an Excel worksheet in my VB.NET code and even though in Excel these dates appear in this format 3/18/04, it is read into my code as a number like this: 36903. I have been told this is a Julian date but the calculations I have found on the internet to handle the conversion gives me dates from 1938 - so either this isn't a Julian number or excel has it's own way of calculating it.
17
71511
by: Terry Jolly | last post by:
New to C# ---- How do I convert a Date to int? In VB6: Dim lDate as long lDate = CLng(Date) In C#
2
8561
by: noopathan | last post by:
Hi experts , I have an excel file in the below format --------------------------------------------------------------------- CodeID CodeName Market Name Date -------------------------------------------------------------------- 1 Sample1 Market1 22/2/2004 -------------------------------------------------------------------- 2 Sample2 Market2 22/2/2003
0
1402
by: payelit21 | last post by:
Hi Friends, can any body help me to convert excel cell from date to general and passinfg value to min value and max value of axis in chart through VB. Thanks Payel
2
5194
budigila
by: budigila | last post by:
Hiya peeps, Okies, I have been trying to work this out for a while now to no avail... I am a beginner to this whole coding thing but have made great strides in my project. Basically what I am trying to do is to convert an .xml using a .xsl to and using a java script to output it into a readable format within excel. I have been able to successfully use a javascript to combine my .xml and .xsl but cannot figure out how to have it output to...
0
9787
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11128
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10838
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9568
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7964
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5794
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3230
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.