I have a datetime and want to format it to "quarter year"
so 20 december 2003 should give: "4-2003"
is this possible?
I don't find a format character for quarter :-(
Dominique 8 11888
Hi Dominique,
I thought that if there was one who knows a lot of dates it was you.
\\\
CInt((Now.Month + 2) / 3).ToString & "-" & Now.Year
////
Would give your result I thought.
Cor I have a datetime and want to format it to "quarter year" so 20 december 2003 should give: "4-2003"
is this possible? I don't find a format character for quarter :-(
yes but no :-)
I need something like:
dim x as DateTime = Now()
dim s as String = x.ToString("qua rter-yyyy")
I know how to do it "manualy" but I get the formatstring out of a database
so your "manual" solution is not a solution in this case...
"Cor" <no*@non.com> wrote in message
news:ui******** ******@tk2msftn gp13.phx.gbl... Hi Dominique,
I thought that if there was one who knows a lot of dates it was you. \\\ CInt((Now.Month + 2) / 3).ToString & "-" & Now.Year ////
Would give your result I thought.
Cor I have a datetime and want to format it to "quarter year" so 20 december 2003 should give: "4-2003"
is this possible? I don't find a format character for quarter :-(
Hi Dominique,
I do not see the problem
Dim datum As Date
datum = DirectCast(dr(" mydate"), Date)
dim s as String = CInt((Datum.Mon th + 2) / 3).ToString & "-" & Datum.Year
What do I see wrong?
If it is with databinding I can it also, but I cannot bring a quarter back
to a date in February.
Cor I need something like: dim x as DateTime = Now() dim s as String = x.ToString("qua rter-yyyy")
I know how to do it "manualy" but I get the formatstring out of a database so your "manual" solution is not a solution in this case...
I thought that if there was one who knows a lot of dates it was you. \\\ CInt((Now.Month + 2) / 3).ToString & "-" & Now.Year ////
Would give your result I thought.
Cor I have a datetime and want to format it to "quarter year" so 20 december 2003 should give: "4-2003"
is this possible? I don't find a format character for quarter :-(
well the problem is this
dim theStringOutOfM yDataBase as String
.... get string out of database...
dim datum as DateTime = Now()
dim showThisOnScree n as String = datum.ToString( theStringOutOfM yDataBase)
theStringOutOfM yDataBase can be for example "dd-MM-yyyy", "MM-yyyy",...
but it should also be able to show the quarter...
so the database contains only a format ("dd-MM-yyyy", "MM-yyyy",...)
the only thing I see if quarter doesn't have a format character is to
introduce one and "pre-format" the formatstring :-)
but this is a unkewl solution...
"Cor" <no*@non.com> wrote in message
news:Os******** ******@TK2MSFTN GP12.phx.gbl... Hi Dominique,
I do not see the problem
Dim datum As Date datum = DirectCast(dr(" mydate"), Date) dim s as String = CInt((Datum.Mon th + 2) / 3).ToString & "-" & Datum.Year
What do I see wrong?
If it is with databinding I can it also, but I cannot bring a quarter back to a date in February.
Cor I need something like: dim x as DateTime = Now() dim s as String = x.ToString("qua rter-yyyy")
I know how to do it "manualy" but I get the formatstring out of a
database so your "manual" solution is not a solution in this case...
I thought that if there was one who knows a lot of dates it was you. \\\ CInt((Now.Month + 2) / 3).ToString & "-" & Now.Year ////
Would give your result I thought.
Cor > I have a datetime and want to format it to "quarter year" > so 20 december 2003 should give: "4-2003" > > is this possible? > I don't find a format character for quarter :-(
Hi Dominique,
If the MM is always written in the string as 01, 02, 03, etc you can because
it is a string make your own function, Q-yyyy and that is than all
equivalents of 1-yyyy etc till 4-yyyy
Just a thought,
Cor dim theStringOutOfM yDataBase as String
... get string out of database...
dim datum as DateTime = Now() dim showThisOnScree n as String = datum.ToString( theStringOutOfM yDataBase) theStringOutOfM yDataBase can be for example "dd-MM-yyyy", "MM-yyyy",... but it should also be able to show the quarter...
so the database contains only a format ("dd-MM-yyyy", "MM-yyyy",...)
the only thing I see if quarter doesn't have a format character is to introduce one and "pre-format" the formatstring :-) but this is a unkewl solution...
"Cor" <no*@non.com> schrieb I thought that if there was one who knows a lot of dates it was you. \\\ CInt((Now.Month + 2) / 3).ToString & "-" & Now.Year ////
Would give your result I thought.
Yep, even without select case.. :-/
--
Armin
"Dominique Vandensteen" <domi.vds_inser t@tralala_tenfo rce.com>
schrieb I have a datetime and want to format it to "quarter year" so 20 december 2003 should give: "4-2003"
is this possible? I don't find a format character for quarter :-(
C'mon, a simple Select case value.month does the job. :-)
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
no it doesn't... in my case :-)
"Armin Zingler" <az*******@free net.de> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. "Dominique Vandensteen" <domi.vds_inser t@tralala_tenfo rce.com> schrieb I have a datetime and want to format it to "quarter year" so 20 december 2003 should give: "4-2003"
is this possible? I don't find a format character for quarter :-(
C'mon, a simple Select case value.month does the job. :-)
-- Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mimi |
last post by:
my database has separate field for date and time so we can capture
employees' time in and out . In Sql, date can be present in smalldatetime
format, which contains only time hh:mm:ss AM/PM. How can I create datetime
format in C# like that in order to update database? Thanks in advance
|
by: Harikumar G |
last post by:
Friends,
My hardware sends me a date format like this
15:10:20.99 UTC Mon Oct 18 2004
I need to process this format and parse to a valid SQL datetime format, how
can I do it more easily? My front-end language is C#
-Hari
|
by: vooose |
last post by:
Suppose you have a DataTable which is part of a DataSet that has a
column of type DateTime.
When you call
ds.GetXml()
the date comes out looking something like this:
2005-01-17T23:01:34.9526250+11:00
|
by: Grey |
last post by:
I use the DateTime format to change the date format, i.e.
string a = "21/02/2004";
Convert.ToDateTime(a).ToString("MMMM dd, yyyy");
These two lines work well in my VS.NET development machine. But it fail in
my production server. I don't know the reason??
My development machine: winXP Pro, VS.NET 2003
My Production machine: Win2000 server with SP4, .NET Framework 1.1
--
Best Regards,
|
by: Esref Durna |
last post by:
my sql server have this datetime format ( yyyy-mm-dd )
how could i change it to dd.mm.yyyy format
or what should i do?
thanks
| |
by: Ugur Ekinci |
last post by:
Hi ,
I have two Sql Server 2000 on seperate machines ,
First one accepts datetime format like ("dd.MM.yyyy hh:mm:ss")
And Second one accepts datetime format like ("MM.dd.yyyy hh:mm:ss")
1- Date formats are different because of SQL Collation?
2- Do regional Settings affect Sql date format?
3- (Important) When inserting a datetime into first server there is no
problem (15.12.2000 12:12:12) , but when I insert into second server (if...
|
by: INeedADip |
last post by:
I have seen this problem posted all over, but have never ran across a
solution....
I am serializing my dataset and they look like this:
<NewDataSet>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
|
by: bhv |
last post by:
hello everybody, i have datetime format in mysql database table. now,
in mysql date is YYYY-MM-DD format. how can i insert date in this
format with VB Script ? i had tried following
dim dt, dy, dm, dd, pd, tm
tm = Time
dt = Date
dy = DatePart("YYYY",dt)
dm = DatePart("M",dt)
dd = DatePart("D", dt)
|
by: LukasMalik |
last post by:
Hi all,
in my application, I am using DateTime. Until I got in contact with SQL I did not try to solve this problem. Where is set DateTime format?
Will somehow change application DateTime format if I install my application on diferent computers with diferent localization and different language OS version?
Current format is dd/mm/yyyy (widely used in Europe). Is format "fixed" with compilation?
Seconds - my solution has more 'projects' as...
|
by: aext |
last post by:
Hi
please If you know how to convert from Decimal format of DateTime to a real Datetime Format reply please because i'm reading a decimal value of time from a file like this one (2448220711) and I Don't know how to get the real dateTime
from This Format .
I will be Thankful if You Reply
Aisha
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
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...
|
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...
|
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,...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
| |
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...
|
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
| |