Due to the much of VBScript inhibition in my early years of website
development, I exhaustively used the following code in my .NET
console applications.
oLog.setStartTi me = Format(Now, "MM/dd/yyyy HH:mm:ss")
This worked fine, when ppl used the code in US.
When the same code was migrated to Singapore, the developers started
to complain about the apparent error that occurs, due to the local
machine settings.
For example a date like 04/25/2007 - the Format() Function which
depends on local machine settings is creating problems.
What is the best practise to get rid of the evil? Pls advise. 3 1115
Local setting shouldn't really matter because you are giving your own
formatting. Anyway, try this: DateTime.Now.To String("MM/dd/yyyy HH:mm:ss")
"n.net" wrote:
Due to the much of VBScript inhibition in my early years of website
development, I exhaustively used the following code in my .NET
console applications.
oLog.setStartTi me = Format(Now, "MM/dd/yyyy HH:mm:ss")
This worked fine, when ppl used the code in US.
When the same code was migrated to Singapore, the developers started
to complain about the apparent error that occurs, due to the local
machine settings.
For example a date like 04/25/2007 - the Format() Function which
depends on local machine settings is creating problems.
What is the best practise to get rid of the evil? Pls advise.
Yeah just check
Dim sTime as DateTime
StartTime = DateTime.Now.To String("MM/dd/yyyy HH:mm:ss")
When i try on 08/06/2007 it works. But when I change the date to
22/06/2007. (The dates I mentioned is 08-Jun-2007 and 22-Jun-2007)
The exception I get is "Cast from string "06/22/2007 10:27:49" to
type 'Date' is not valid."
Pls advise.
On Apr 25, 1:52 pm, Siva M <shiva...@onlin e.excite.comwro te:
Local setting shouldn't really matter because you are giving your own
formatting. Anyway, try this: DateTime.Now.To String("MM/dd/yyyy HH:mm:ss")
"n.net" wrote:
Due to the much of VBScript inhibition in my early years of website
development, I exhaustively used the following code in my .NET
console applications.
oLog.setStartTi me = Format(Now, "MM/dd/yyyy HH:mm:ss")
This worked fine, when ppl used the code in US.
When the same code was migrated to Singapore, the developers started
to complain about the apparent error that occurs, due to the local
machine settings.
For example a date like 04/25/2007 - the Format() Function which
depends on local machine settings is creating problems.
What is the best practise to get rid of the evil? Pls advise.- Hide quoted text -
- Show quoted text -
n.net wrote:
Yeah just check
Dim sTime as DateTime
StartTime = DateTime.Now.To String("MM/dd/yyyy HH:mm:ss")
When i try on 08/06/2007 it works. But when I change the date to
22/06/2007. (The dates I mentioned is 08-Jun-2007 and 22-Jun-2007)
The exception I get is "Cast from string "06/22/2007 10:27:49" to
type 'Date' is not valid."
The code that you showed can not produce that error message, as you are
not converting a string to a date in that code.
When you parse the string, either specify a culture that uses that date
format, or use DateTime.ParseE xact with the same formatting string as
you used to create the string.
--
Göran Andersson
_____ http://www.guffa.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: J |
last post by:
Would anyone know if there a type tag to format a double?
I have f for floating point, but cannot find one for double.
|
by: martini |
last post by:
Problem with time zone on linux. I have a dual processor machine
running with mandrake 10.1. I have some issues with the localtime and
strftime functions. Sometimes it returns the date of the system in a
GMT format and sometimes in CEST format (that I have configured on the
linux timezone configuration for Spain Time zone).
Any ideas?, Is it...
|
by: milkyway |
last post by:
Hello,
I have an HTML page that I am trying to import 2 .js file (I created)
into. These files are: row_functions.js and data_check_functions.js.
Whenever I bring the contents of the files into this HTML file, all is
OK but whenever the functions are separated (as it is now), when I run
the page, I get the following error:
Line 73,...
|
by: Grumble |
last post by:
Hello,
I have the following structure:
struct foo {
char *format; /* format string to be used with printf() */
int nparm; /* number of %d specifiers in the format string */
/* 0 <= nparm <= 4 */
};
|
by: Kay |
last post by:
1) If i want to read data from a txt file,
eg John; 23; a
Mary; 16; i
How can I read the above data stopping reading b4 each semi-colon and
save it in three different variables ?
2) If I enter a number, can I use to call a particular node ?
eg enter a number: 3
calling node of number 3
is it possible ?
| |
by: Matt |
last post by:
I'm trying to write a shared function that will convert all my phone numbers
from format 1234567890 to (123) 456-7890.
Here is my function that I wrote:
Public Shared Function CheckPhone(byVal val as String) as String
dim strCheckPhone as String
If val = "" Then
strCheckPhone = ""
|
by: Assimalyst |
last post by:
Hi,
I have a working script that converts a dd/mm/yyyy text box date entry
to yyyy/mm/dd and compares it to the current date, giving an error
through an asp.net custom validator, it is as follows:
function doDateCheckNow(source, args)
{
var oDate = document.getElementById(source.controltovalidate); //
dd/mm/yyyy
|
by: comp.lang.tcl |
last post by:
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML
file into a TCL list as follows:
attr1 {val1} attr2 {val2} ... attrN {valN}
This is the TCL code that does this:
set contents ]; close $fileID
|
by: aljaber |
last post by:
hi,
i am facing a problem with my program output
here is the program
/*********************************************\
* CD Database *
* *
\*********************************************/
|
by: Einstein30000 |
last post by:
Hi,
in one of my php-scripts is the following query (with an already open
db-connection):
$q = "INSERT INTO main (name, img, descr, from, size, format, cat,
host, link, date) VALUES ('$name', '$img', '$descr', '$user', '$size',
'$format', '$cat', '$host', '$link', '$date')" or die(mysql_error());
And when the query gets executed i get...
|
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...
| |
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
| |
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |