473,379 Members | 1,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Creating Text File

I'm using ASP 3.0. I'm taking form contents and dumping it into a text file
on the server.
My question is how to add the TIME to this statement. I create the text file
with the name of file, month, day and year.
I would like to add TIME to it.
-------------------------------------------------------------
set fso = createobject("scripting.filesystemobject")

Set act = fso.CreateTextFile(server.mappath("/data/"&g_filename & "-"&
month(date())& day(date())& year(date()) &".htm"), true)
-------------------------------------------------------------
Thank you,

Erik
Jul 19 '05 #1
5 3247
look at Now()
perhaps (not sure) Time() as well

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Erik" <ER*******@pacificdesignstudios.com> wrote in message
news:e8**************@TK2MSFTNGP12.phx.gbl...
I'm using ASP 3.0. I'm taking form contents and dumping it into a text file on the server.
My question is how to add the TIME to this statement. I create the text file with the name of file, month, day and year.
I would like to add TIME to it.
-------------------------------------------------------------
set fso = createobject("scripting.filesystemobject")

Set act = fso.CreateTextFile(server.mappath("/data/"&g_filename & "-"&
month(date())& day(date())& year(date()) &".htm"), true)
-------------------------------------------------------------
Thank you,

Erik

Jul 19 '05 #2
I tried it already and the error I receive is that it is not part of the
mappath property.

Thanks.

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:Ot**************@TK2MSFTNGP11.phx.gbl...
look at Now()
perhaps (not sure) Time() as well

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
..Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Erik" <ER*******@pacificdesignstudios.com> wrote in message
news:e8**************@TK2MSFTNGP12.phx.gbl...
I'm using ASP 3.0. I'm taking form contents and dumping it into a text

file
on the server.
My question is how to add the TIME to this statement. I create the text

file
with the name of file, month, day and year.
I would like to add TIME to it.
-------------------------------------------------------------
set fso = createobject("scripting.filesystemobject")

Set act = fso.CreateTextFile(server.mappath("/data/"&g_filename & "-"&
month(date())& day(date())& year(date()) &".htm"), true)
-------------------------------------------------------------
Thank you,

Erik


Jul 19 '05 #3
Function GetFileStamp()
Dim ary1(5)
ary1(0) = Year(Date)
ary1(1) = Pad(Month(Date))
ary1(2) = Pad(Day(Date))
ary1(3) = Pad(Hour(Now()))
ary1(4) = Pad(Minute(Now()))
ary1(5) = Pad(Second(Now()))
GetFileStamp = Join(ary1,"")
End Function
Function Pad(strData)
Pad = Trim(strData)
If Len(Pad) = 1 Then
Pad = "0" & Pad
End If
End Function
dlbjr

Unambit from meager knowledge of inane others,
engender uncharted sagacity.
Jul 19 '05 #4
The probable reason you get the error, and the reason dlbjr's code would
work, is that Time values include colons (:) which can't be used in a
Windows filename.

The other possible cause is that you typed something wrong, or put the Now()
function in the wrong part of your concatenation mess. In this case,
dlbjr's function still makes sense because 1) it makes your code easier to
read and 2) it makes your code easier to reuse.
"Erik" <ER*******@pacificdesignstudios.com> wrote in message
news:ej**************@TK2MSFTNGP09.phx.gbl...
I tried it already and the error I receive is that it is not part of the
mappath property.

Thanks.

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:Ot**************@TK2MSFTNGP11.phx.gbl...
look at Now()
perhaps (not sure) Time() as well

--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
..Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Erik" <ER*******@pacificdesignstudios.com> wrote in message
news:e8**************@TK2MSFTNGP12.phx.gbl...
I'm using ASP 3.0. I'm taking form contents and dumping it into a text

file
on the server.
My question is how to add the TIME to this statement. I create the
text file
with the name of file, month, day and year.
I would like to add TIME to it.
-------------------------------------------------------------
set fso = createobject("scripting.filesystemobject")

Set act = fso.CreateTextFile(server.mappath("/data/"&g_filename & "-"&
month(date())& day(date())& year(date()) &".htm"), true)
-------------------------------------------------------------
Thank you,

Erik



Jul 19 '05 #5
"Erik" <ER*******@pacificdesignstudios.com> wrote in message
news:e8**************@TK2MSFTNGP12.phx.gbl...
I'm using ASP 3.0. I'm taking form contents and dumping it into a text file on the server.
My question is how to add the TIME to this statement. I create the text file with the name of file, month, day and year.
I would like to add TIME to it.
-------------------------------------------------------------
set fso = createobject("scripting.filesystemobject")

Set act = fso.CreateTextFile(server.mappath("/data/"&g_filename & "-"&
month(date())& day(date())& year(date()) &".htm"), true)
-------------------------------------------------------------
Thank you,

Erik

Here's how I create a timestamp vbscript:

'*
'* Generate Timestamp (ccyymmddhhnnss)
'*
Dim strNOW
strNOW = Now()
Dim arrNOW(5)
arrNOW(0) = DatePart("yyyy", strNOW)
arrNOW(1) = DatePart("m", strNOW)
arrNOW(2) = DatePart("d", strNOW)
arrNOW(3) = DatePart("h", strNOW)
arrNOW(4) = DatePart("n", strNOW)
arrNOW(5) = DatePart("s", strNOW)
Dim intNOW
strNOW = ""
For intNOW = 0 To UBound(arrNOW)
If (arrNOW(intNOW) <= 9) Then arrNOW(intNOW) = "0" & arrNOW(intNOW)
strNOW = strNOW & arrNOW(intNOW)
Next

Thus, you would use:

Set act = fso.CreateTextFile(server.mappath("/data/" & g_filename & "-" &
strNOW & ".htm"), true)

You had "mmddyy" but I prefer this format which allows multiple files to be
sorted chronologically.

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: va | last post by:
I am trying to create recordset from a text file. The text file contains header and records. The text file is tab delimited. I am using the following statement to create the recordset Call...
4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
0
by: James Fortune | last post by:
Here is an example of Access creating a single page PDF file. The text in the textbox is scaled to fit horizontally into a grey box 100 pixels wide that is fontsize pixels high. Clicking the...
9
by: Maziar Aflatoun | last post by:
Hi everyone, I like to export some data from the database and allow my users to store this file to their harddrive as a .txt file. Does anyone know how I would go about doing that? (without...
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
2
by: Astra | last post by:
Hi All Creating an rss.xml file dynamically via ASP/ADO/DB, but find errors in the file. Don't think it's an ASP prob to be honest. Think its more to do with the fact that the ampersands are...
4
by: tshad | last post by:
I am trying to set up an Image authorization where you type in the value that is in a picture to log on to our site. I found a program that is supposed to do it, but it doesn't seem to work. ...
5
eragon
by: eragon | last post by:
I wrote this function to create a new file when the user posts in my forums, and its not creating a new file, can you help me? this script is not copyrighted as the last one. function...
2
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. creating a method to search a tree to find the position of node and to return its pointer value basically i...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.