Hello everyone:
I want to change this date "12 Apr 2006 23:35:47" into "2006-04-12 23:35:47",I have tested lots of parameters of the command "date",but it still not execute UNDER FreeBSD,pls help me,thanks!
Hello everyone:
I want to change this date "12 Apr 2006 23:35:47" into "2006-04-12 23:35:47",I have tested lots of parameters of the command "date",but it still not execute UNDER FreeBSD,pls help me,thanks!
Jump to PostChoices
1. install GNU date (the linux version) so you can use the --date option.
Also check the man page for your current version of date - it may be a GNU variant.2. use C's strptime() function and strftime() function in a small C program
3. install …
Choices
1. install GNU date (the linux version) so you can use the --date option.
Also check the man page for your current version of date - it may be a GNU variant.
2. use C's strptime() function and strftime() function in a small C program
3. install the DATE module for perl, use str2time and format the date
Choices
1. install GNU date (the linux version) so you can use the --date option.
Also check the man page for your current version of date - it may be a GNU variant.2. use C's strptime() function and strftime() function in a small C program
3. install the DATE module for perl, use str2time and format the date
Hi jim mcnamara:
Nice to see you.I think so,and thank you for your reply!
Hello all:
I get it:
date -j -f "%d %b %Y %T" "12 Apr 2006 23:35:47" +"%F %H:%M:%S"(UNDER freeBSD)
In this way,you can format every date type you want!(Happy~)
For example, this command (under FreeBSD) will change the output of 'date' command:
date -j +%Y%m%d
20080818
But for your kind of output, the commad should be:
date -j +"%Y-%m-%d %H:%M:%S"
2008-08-18 16:57:59
Cya
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.