This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Date help

Old posts that have not been replied to for several years.
Locked
k
keown
Voice
Posts: 3
Joined: Tue Nov 09, 2004 4:57 pm

Date help

Post by keown »

Hey

I have a script that communicates with a MySql-database. But I dont know how to put the date properly. The date should be the current date! I want it like: YYYY-MM-DD.
Right now it is this way: set date [unixtime]
...but that only gives some numbers like 1117240297.

Thanks for any help!
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

change it to

Code: Select all

set date [strftime %Y-%m-%d]
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

From tcl-commands.doc:
unixtime
Returns: a long integer which represents the number of seconds that have
passed since 00:00 Jan 1, 1970 (GMT).
Module: core

ctime <unixtime>
Returns: a formatted date/time string based on the current locale
settings from the unixtime string given; for example "Fri Aug 3
11:34:55 1973"
Module: core
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

set date [strftime %v]
returns dd-month-yyyy

Code: Select all

set date [strftime %x]
returns mm/dd/yy
k
keown
Voice
Posts: 3
Joined: Tue Nov 09, 2004 4:57 pm

Post by keown »

Thanks guys! :)
Locked