473,511 Members | 14,975 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

file save

I need to save a file in this format: fileName_YYYYMMdd.txt.
I forget the syntax to get the date in the file name, could some one help me
out on this one?

Nov 17 '05 #1
5 2028
You'll need to use the System.DateTime class. Usage should be fairly
obvious.

Nov 17 '05 #2
this is what i have and it keeps giving me an error:
file name or path does not exist
file is in use by another program
the file is new, it does not exist, etc.

here is my syntax
string fileName = "test_" + System.DateTime.Now.ToShortDateString() +
".doc";

now if i hard code a date in there i'm fine, or put another variable in
there i'm fine, but this syntax errors out on me
"Adam" <ad************@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
You'll need to use the System.DateTime class. Usage should be fairly
obvious.

Nov 17 '05 #3
string fmt = filename + DateTime.Now.ToString("yyyyMMdd") + ".txt";

"microsoft.news.com" <CSharpCoder> wrote in message
news:O7**************@tk2msftngp13.phx.gbl...
I need to save a file in this format: fileName_YYYYMMdd.txt.
I forget the syntax to get the date in the file name, could some one help
me out on this one?

Nov 17 '05 #4
thanks
"Matt" <md*****@sorvive.DONT-SEND-SPAM.com> wrote in message
news:Os**************@TK2MSFTNGP10.phx.gbl...
string fmt = filename + DateTime.Now.ToString("yyyyMMdd") + ".txt";

"microsoft.news.com" <CSharpCoder> wrote in message
news:O7**************@tk2msftngp13.phx.gbl...
I need to save a file in this format: fileName_YYYYMMdd.txt.
I forget the syntax to get the date in the file name, could some one help
me out on this one?


Nov 17 '05 #5
Hi,

It' s cause the separator , the default shoudl be / or maybe \ just use
ToString("yyMMdd")

Note theck the DAteTime.ToString method to see if the format is the correct
one or to see other formats available
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"microsoft.news.com" <CSharpCoder> wrote in message
news:el**************@TK2MSFTNGP09.phx.gbl...
this is what i have and it keeps giving me an error:
file name or path does not exist
file is in use by another program
the file is new, it does not exist, etc.

here is my syntax
string fileName = "test_" + System.DateTime.Now.ToShortDateString() +
".doc";

now if i hard code a date in there i'm fine, or put another variable in
there i'm fine, but this syntax errors out on me
"Adam" <ad************@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
You'll need to use the System.DateTime class. Usage should be fairly
obvious.


Nov 17 '05 #6

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

Similar topics

3
2287
by: kimimaro | last post by:
hi below is my save function that is used to placed data from the C program to a text file for future usage. void save() { FILE *save; int i = 0; save=fopen("employeerecord.txt", "a+");
0
6413
by: a | last post by:
Save text file as html kloepper 17:42 23 Jul '04 I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html...
5
6853
by: kevin | last post by:
Hi, Any help with this would be really appreciated! I'm trying to download a file from a remote server. The access permissions is okay but the problem I'm facing is that the file is getting...
10
4324
by: GJP | last post by:
Hello. Ive been asked to make my own notepade for college assignment. All ig going well, but i cant get the save to work. I can get Save a (shows dialog box), i can get it to just save too,...
0
1902
by: maitrepoy | last post by:
Hello I have to create a small addin which works on Powerpoint, Word, Outlook, and Excel on Office 2000, XP, and 2003. This addin consists in adding 2 new Buttons in the "File" Menu of office....
0
2402
by: maitrepoy | last post by:
hello I have to create a small addin which works on Powerpoint, Word, Outlook, and Excel on Office 2000, XP, and 2003. This addin consists in adding 2 new Buttons in the "File" Menu of office....
24
1922
by: Kelly | last post by:
Hey all - I need a little more help. I don't quite know why my text file or form isn't closing. Short version - this program takes data entered into a textbox, user clicks Save button, Save...
13
13182
by: Hemant Sipahimalani | last post by:
The following piece of code is being used to export HTML to excel. HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"...
17
7988
by: Peter Duniho | last post by:
I searched using Google, on the web and in the newsgroups, and found nothing on this topic. Hopefully that means I just don't understand what I'm supposed to be doing here. :) The problem: ...
7
2670
by: ConfusedAlot | last post by:
This is my code for a database, whenever i save the database to the file 'database.txt' and display the results i get this; name - (correct, is what i put in) pin - 3435973836 slew rate -...
0
7252
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7371
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,...
0
7432
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...
0
5676
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,...
1
5077
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...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.