473,322 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

UNIX timestamp

How to make a sql statement for converting UNIX timestamp to our date in GMT? Because i have a little difficult about this statement. Here's my sql statement:

------------------------------------------------------------------------------
SELECT DATE_FORMAT(startdate , '%b %D %Y')
AS startdate
FROM mdl_course
------------------------------------------------------------------------------

Table: mdl_course

Field:
startdate enddate
1165420860 1166025540
Jan 3 '07 #1
2 4590
bartonc
6,596 Expert 4TB
How to make a sql statement for converting UNIX timestamp to our date in GMT? Because i have a little difficult about this statement. Here's my sql statement:

------------------------------------------------------------------------------
SELECT DATE_FORMAT(startdate , '%b %D %Y')
AS startdate
FROM mdl_course
------------------------------------------------------------------------------

Table: mdl_course

Field:
startdate enddate
1165420860 1166025540
Use
mysql> SELECT FROM_UNIXTIME(875996580);
-> '1997-10-04 22:23:00'
to get a date, then format.
Jan 3 '07 #2
bartonc
6,596 Expert 4TB
Use
mysql> SELECT FROM_UNIXTIME(875996580);
-> '1997-10-04 22:23:00'
to get a date, then format.
or better

FROM_UNIXTIME(unix_timestamp,format)
If format is given, the result is formatted according to the format string. format may contain the same specifiers as those listed in the entry for the DATE_FORMAT() function.
Jan 3 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: kingofkolt | last post by:
All, What do you recommend as the best type of field for a timestamp in a MySQL database? I've considered varchar(10) or INT but I'm not sure what is the best, most efficient, and most reliable...
13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
0
by: Casey | last post by:
Hi! I found several resources describing how to convert the UNIX timestamp to a readable date, however I need to convert a date into a UNIX timestamp. For instance, I'm writing a program that will...
2
by: In. Martin Prá¹ek | last post by:
I I read the documentation well (PG 7.3.3 ) , i see that there is not a native support for data type UNIX TIMESTAMP and "unix timestamp expressed as microseconds" ie there it is impossible...
0
by: NTPT | last post by:
I read the documentation well (PG 7.3.3 ) , it seems that there is not a native support for data type UNIX TIMESTAMP and "unix timestamp expressedas microseconds" ie there it is impossible...
4
by: Mark Harrison | last post by:
So, I'm recording the timestamp from some unix files. Any opinions as to whether it's best to use a "bigint" (which matches the file system data) or a "timestamp" (which might be easier to...
2
by: John Reese | last post by:
Hi. >>> import time, calendar, datetime >>> n= 1133893540.874922 >>> datetime.datetime.fromtimestamp(n) datetime.datetime(2005, 12, 6, 10, 25, 40, 874922) >>> lt= _ >>>...
2
by: Luis P. Mendes | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I've inserted a couple hundred rows in a table in Postgres via psycopg2. The first field of each row is a certain unix time (since epoch)...
6
by: marc | last post by:
hi im trying to convert Date() into a unix timestamp so i can stick the result into a mysql db, please help!
4
by: skulkrinbait | last post by:
Hello How can I convert a date into the Unix timestamp? I don't really mind what format the date is in, something like MMDDYY would be fine, can someone show me what code I would need to do...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.