11-11-2013
[Solved] Convert string into date format
Hi,
I am getting the below string as a input for date.
12/03/2013 11:02 AM
I want to change this date as 03-DEC-2013 11:02 AM.
Could you please help on this.
Thanks
Chelladurai
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi,
for reading a cobol indexed file i need to convert "mmddyy" date format to "ccyyddd" format.
i checked the datecalc and other scripts but couldnt modify them to cater to my need:(...
The datecalc gives an output which i believe is the total days till that date, but i want to convert it... (2 Replies)
Discussion started by: Bhups
2 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
Need your help in converting a date format in ksh.
I'm currently working on SUN os where my script is getting a date from a table.
The result returns to ksh in this format: 17-JUL-08
How do i convert this string to a date format like yyyymmdd?
I tried #!/bin/ksh
d="17-JUL-08"... (5 Replies)
Discussion started by: agathaeleanor
5 Replies
3. Shell Programming and Scripting
I have a comma delimited log file which has the date as MM/DD/YY in the 2nd column, and HH:MM:SS in the 3rd column.
I need to change the date format to YYYY-MM-DD and merge it with the the time HH:MM:SS. How will I got about this?
Sample input
02/27/09,23:52:31
02/27/09,23:52:52... (3 Replies)
Discussion started by: hazno
3 Replies
4. Shell Programming and Scripting
Hi All,
I have a string like below.
"Mar 31 2009" .
I want to convert this to unix time .
Also please let me know how to find the unix time for the above string minus one day. For Eg. if i have string "Mar 31 2009" i want to find the unix time stamp of "Mar 30 2009".
Thanks in advance,... (11 Replies)
Discussion started by: girish.raos
11 Replies
5. Shell Programming and Scripting
I've been using this thread:
https://www.unix.com/shell-programming-scripting/58675-change-date-dd-mmm-yyyy-mm-dd-yyyy.html
and
https://www.unix.com/shell-programming-scripting/14655-changing-yyyy-mm-dd-ddmmyy.html
and this code:
on this format:
05/16/2008 18:30:49 Installation 48985and I'm... (3 Replies)
Discussion started by: dba_frog
3 Replies
6. Shell Programming and Scripting
Could you tell me how to convert the following dates?
If I have m/d/yyyy, I want to have
0m/0d/yyyy. I want my dates to always be 8 digits.
In other words, I want a 0 inserted whenever the month or day is a single digit.
My issue is first I need to use FS="," to get field $4 for the... (7 Replies)
Discussion started by: wbrunc
7 Replies
7. Shell Programming and Scripting
Hello,
I want to change the format of date value in variable.
e.g. cur_date = '2013/03/13 14:24:50' (yyyy/mm/dd hh24:mi:ss)
I want to change this to '13-MAR-2013 14:24:50
Following code coverts the current date to format I am looking for. But I do not know how this can be done for a date... (8 Replies)
Discussion started by: cartrider
8 Replies
8. Shell Programming and Scripting
Hi guys
I am looking to convert this kind of entry in a txt file
26/04/2008
to
April 2008
Note : this is not using the date command , these are date entries in a file
can i do this with sed ?
Use code tags, thanks. (5 Replies)
Discussion started by: johnnybananas
5 Replies
9. Shell Programming and Scripting
Hi All
I need help in converting a string of YYYYMMDD format to date in Sun OS and then find out if the day is a Wednesday or not. The "date -d" option is not working and your help is much appreciated.
The date command usage from the operating system we use here is as follows:
usage: ... (1 Reply)
Discussion started by: SK123
1 Replies
10. Solaris
Hi All
I need help in converting a string of YYYYMMDD format to date in Sun OS and then find out if the day is a Wednesday or not. The "date -d" option is not working and your help is much appreciated.
The date command usage from the operating system we use here is as follows:
Thanks,
SK (11 Replies)
Discussion started by: SK123
11 Replies
LEARN ABOUT PHP
datefmt_format_object
DATEFMT_FORMAT_OBJECT(3) 1 DATEFMT_FORMAT_OBJECT(3)
IntlDateFormatter::formatObject - Formats an object
Object oriented style
SYNOPSIS
publicstatic string IntlDateFormatter::formatObject (object $object, [mixed $format = NULL], [string $locale = NULL])
DESCRIPTION
Procedural style string datefmt_format_object (object $object, [mixed $format = NULL], [string $locale = NULL])
This function allows formatting an IntlCalendar or DateTime object without first explicitly creating a IntlDateFormatter object.
The temporary IntlDateFormatter that will be created will take the timezone from the passed in object. The timezone database bundled with
PHP will not be used - ICU's will be used instead. The timezone identifier used in DateTime objects must therefore also exist in ICU's
database.
PARAMETERS
o $object
- An object of type IntlCalendar or DateTime. The timezone information in the object will be used.
o $format
- How to format the date/time. This can either be an array with two elements (first the date style, then the time style, these
being one of the constants IntlDateFormatter::NONE, IntlDateFormatter::SHORT, IntlDateFormatter::MEDIUM, IntlDateFormatter::LONG,
IntlDateFormatter::FULL), a long with the value of one of these constants (in which case it will be used both for the time and the
date) or a string with the format described in the ICU documentation. If NULL, the default style will be used.
o $locale
- The locale to use, or NULL to use the default one.
RETURN VALUES
A string with result or FALSE on failure.
EXAMPLES
Example #1
datefmt_format_object(3) examples
<?php
/* default timezone is irrelevant; timezone taken from the object */
ini_set('date.timezone', 'UTC');
/* default locale is taken from this ini setting */
ini_set('intl.default_locale', 'fr_FR');
$cal = IntlCalendar::fromDateTime("2013-06-06 17:05:06 Europe/Dublin");
echo "default:
",
IntlDateFormatter::formatObject($cal),
"
";
echo "long $format (full):
",
IntlDateFormatter::formatObject($cal, IntlDateFormatter::FULL),
"
";
echo "array $format (none, full):
",
IntlDateFormatter::formatObject($cal, array(
IntlDateFormatter::NONE,
IntlDateFormatter::FULL)),
"
";
echo "string $format (d 'of' MMMM y):
",
IntlDateFormatter::formatObject($cal, "d 'of' MMMM y", 'en_US'),
"
";
echo "with DateTime:
",
IntlDateFormatter::formatObject(
new DateTime("2013-09-09 09:09:09 Europe/Madrid"),
IntlDateFormatter::FULL,
'es_ES'),
"
";
The above example will output:
default:
6 juin 2013 17:05:06
long $format (full):
jeudi 6 juin 2013 17:05:06 heure d'ete irlandaise
array $format (none, full):
17:05:06 heure d'ete irlandaise
string $format (d 'of' MMMM y):
6 of June 2013
with DateTime:
lunes, 9 de septiembre de 2013 09:09:09 Hora de verano de Europa central
PHP Documentation Group DATEFMT_FORMAT_OBJECT(3)