[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: Re: Cannot get date fields to import from PostgreSQL via ODBC
-----BEGIN PGP SIGNED MESSAGE-----
On Tuesday, 27.09.2005 at 23:23 +0900, Joseph Coveney wrote:
> > Ah, interesting: that certainly appears to work, in the sense that it
> > reads in the dates as strings.
> > However, this doesn't actually give you 'proper' date variables, does
> > it? I realise one can string-splice to pull out the components of the
> > date, but that's rather tedious.
> > [excerpted]
> > Can you suggest a way to 'transparently' import these dates as 'proper'
> > date variables? Or at least a way to easily re-type the imported
> > strings as dates?
> Starting with a date variable imported as a string, e.g.,
> set obs 1
> generate str c = "2004-01-01 19:27:03" ,
> then you can re-type it in two lines of code:
> generate int c_date = date(substr(c, 1, 10), "ymd")
> format c_date %dCY-N-D
Excellent, Joseph: many thanks!
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from http://www.ceu.ox.ac.uk/~davee/davee-ceu-ox-ac-uk.asc
N 51.7518, W 1.2016
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
-----END PGP SIGNATURE-----
* For searches and help try: