473,788 Members | 2,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Splitting one field into several

Hi,

I have a field in a database called "Timestamp" which has the date and time
of an event, for example:

"01/02/2002 09:07:59"

The format is MM/DD/YYYY HH:MM:SS

I want to chop the field into six seperate fields of MM, DD, YYYY, HH, MM &
SS but cannot find a way of doing this in Access without resorting to
exporting as a text file and re-importing as a fixed width file.

Can anyone help?

Many thanks

L
Nov 13 '05 #1
3 1589
What are you going to do with them seperated?

Create the extra fields first. Then make an update query and use the
format function or there are month, day, year, second, minute, hour
functions. Check access help.

Nov 13 '05 #2
You could create a query to get the pieces you want... what do you need
to do with the data that requires this?
check out DatePart, Month(), Year(), Hour(),Minute() ... etc.
you could do all this in a query at runtime, if you wanted...

La di da Limey wrote:
Hi,

I have a field in a database called "Timestamp" which has the date and time of an event, for example:

"01/02/2002 09:07:59"

The format is MM/DD/YYYY HH:MM:SS

I want to chop the field into six seperate fields of MM, DD, YYYY, HH, MM & SS but cannot find a way of doing this in Access without resorting to
exporting as a text file and re-importing as a fixed width file.

Can anyone help?

Many thanks

L


Nov 13 '05 #3
On Wed, 09 Mar 2005 16:47:29 GMT, La di da Limey wrote:
Hi,

I have a field in a database called "Timestamp" which has the date and time
of an event, for example:

"01/02/2002 09:07:59"

The format is MM/DD/YYYY HH:MM:SS

I want to chop the field into six seperate fields of MM, DD, YYYY, HH, MM &
SS but cannot find a way of doing this in Access without resorting to
exporting as a text file and re-importing as a fixed width file.

Can anyone help?

Many thanks

L


Why bother?

Access stores date/time as a double number, counting the number of
days from 12/30/1899, and time as the percentage of a 24 hour day from
midnight.
So 3/9/2005 09:02:00 AM is stored as 38420.376689814 8.

How the date is formatted is not relevant as long as it is a date
datatype field.

If the date field already contains the full date and time, all you
need do, whenever you wish to show those separate values, is use:
=Year([DateField]) (year)
=DatePart("m",[DateField]) (month)
=Month([DateField]) (month)
=DatePart("d",[DateField]) (Date day)
= DatePart("h',[dateField]) (hour)
=DatePart("n",[dateField]) (minute)
etc.
Look up DatePartI(), Month(), Year(), WeekDay(), etc. for additional
arguments to return the parts of a date datatype field.

Or you can simply format the date field to show the part you want:
=Format(DateFie ld],"mmm") will display March.

Hope this helps.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #4

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

Similar topics

10
1933
by: Angelo Secchi | last post by:
Hi, I have string of numbers and words like ',,,,,,23,,,asd,,,,,"name,surname",,,,,,,\n' and I would like to split (I'm using string.split()) it using comma as separator but I do not want to split in two also the "name,surname" field. In other word I would like python in separating fields to skip that particular comma.
26
808
by: Kai Jaensch | last post by:
Hello, i am an newbie and i have to to solve this problem as fast as i can. But at this time i don´t have a lot of success. Can anybody help me (and understand my english :-))? I have a .txt-file in which the data is structured in that way: Project-Nr. ID name lastname 33 9 Lars Lundel 33 12 Emil Korla
3
4144
by: Rakesh | last post by:
Hi, I was 'googling' to look out for some ways of optimizing the code and came across this term - 'hot / cold splitting'. In short, the discussion is about splitting heavily accessed ( hot ) portions of data structure from rarely accessed cold portions. I haven't used this one myself anytime before, but am interested in learning more about this. Can you please share your experience here, so that I can understand better and this could...
4
2710
by: guitarromantic | last post by:
Hey everyone. Following advice found online, I figured out a basic way of splitting a long article into several pages, by exploding out from a <!--pagebreak--> code in my $content field. http://www.scenepointblank.com/matt/dev/features/index.php?id=1&page=1 Sample above. The next/previous links were built with simple values:
2
2096
by: Gary Lynch | last post by:
I am looking for a simple solution to a recurrent problem with imported data in Access 97. The example below is a simplification of a problem with a much larger database. Let's say I start out with a single table, describing the colors of 4 national flags. I have 4 fields: Country Text 1stColor Text 2ndColor Text 3rdColor Text
5
1291
by: Peter Oliphant | last post by:
I was thinking it might be a good idea to split this newsgroup into different newsgroups, depending on the version of VS C++.NET being discussed. Thus, there would be 2002, 2003, and 2005 newsgroups instead of just one for all. This would at least end any confusion if someone asks a question and doesn't state which version they are using (which of course can change the answer to such questions). Just a thought...
3
1618
by: aaronvb | last post by:
Hi there, I'm currently trying to fix up a database that has had many different people work on it and therefore is confusing me no end. Currently i am trying to update a field, in the table . is a numeric field and is linked to the (its the PK)
4
3823
by: Steven D'Aprano | last post by:
I'm trying to split a URL into components. For example: URL = 'http://steve:secret@www.domain.com.au:82/dir" + \ 'ectory/file.html;params?query#fragment' (joining the strings above with plus has no significance, it's just to avoid word-wrapping) If I split the URL, I would like to get the following components:
37
1864
by: xyz | last post by:
I have a string 16:23:18.659343 131.188.37.230.22 131.188.37.59.1398 tcp 168 for example lets say for the above string 16:23:18.659343 -- time 131.188.37.230 -- srcaddress 22 --srcport 131.188.37.59 --destaddress 1398 --destport tcp --protocol
0
10373
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...
1
10118
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
9969
tracyyun
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...
0
8995
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
7519
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
6750
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5403
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...
1
4074
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
2
3677
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.