• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Access export date and time fields and keep certain format

I have a query that I am exporting and need to keep the format a certain way.
the date needs to look like this

20090707 for July 7, 2009

I have the format correct in the query but when I export it it turns to this.

7/7/2009 1:47:58 PM

Same with the time - I have it set to HHMMSS
hour minute second
and when exporting I get

1:47:58 PM

0
Pdeters
Asked:
Pdeters
  • 2
1 Solution
 
pssandhuCommented:
FORMAT([Table].[Field], "yyyyMMdd")
Wouldn't this work.
P.
0
 
pssandhuCommented:
Also, if you are exporting the result into another table then make sure the target column default format is set to yyyyMMdd. You can set this in the table design mode.
P.
0
 
PdetersAuthor Commented:
I put in the query as it is not pulling a date but using today's date

Format(Date(),"yyyyMMdd")

Thanks!1
0
 
dvz-Commented:
You can also try

date_format([table].[fld], '%Y%m%d')
#should print "yyyymmdd" 20090631

and

date_format([table].[fld], '%h%i%s')
#should print "hhmmss"

query usage:
$query = "SELECT date_format(datefld , '%Y%m%d') FROM ourTable";

Hope this helps.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now